0
的那一刻我想下面的表保存:需要保存數據
http://img5.fotos-hochladen.net/uploads/tabelle1k6xegf4tm.jpg
只有-fields當我點擊下方的藍色按鈕進行保存表。 我的問題:我是joomla的新手,不知道如何保存這個。 我使用正確的類嗎? 有沒有可能通過表級解決這個問題? 也許有人可以給我一個組件,在這樣的事情解決? 或者可以給我正確的代碼樣本?
在這裏您可以找到我做了什麼:
class TippspielModelTippview extends JModelList
{
protected function getListQuery()
{
//Erstelle ein neues Query-Objekt
$db= JFactory::getDbo();
$query= $db->getQuery(true);
//Hole alle Daten
$query->select('t2.id, t2.date, t2.goalsteam1, t2.goalsteam2, t1a.team AS mannschaft1, t1b.team AS mannschaft2');
$query->from('#__tournament AS t2');
$query->join('left','#__team AS t1a ON t2.team1 = t1a.id');
$query->join('left','#__team AS t1b ON t2.team2 = t1b.id');
$query->order('date');
//und liefere es zurück
return $query;
}
}
觀
class TippspielViewTippview extends JViewLegacy
{
//Variable zur Speicherung aller Teams
protected $pages;
protected $games;
function display($tpl = null)
{
//Hole Daten aus dem Modul
$this->games = $this->get('Items');
$this->pages = $this->get('Pagination');
//Layout aktivieren und ausgeben
parent::display($tpl);
}
}
表單
<form action="<?php echo JRoute::_('index.php?option=com_tippspiel&view=tippview'); ?>" method= "post" name="adminForm" id="adminForm">
<?php echo $this->pages->getLimitBox(); ?>
<table class="table table-striped">
<thead>
<tr>
<th>Heim</th>
<th>Gast</th>
<th>Spielbeginn</th>
<th>Tipp</th>
<th>Ergebnis</th>
<th>Punkte</th>
</tr>
</thead>
<tbody>
<?php foreach($this->games as $i => $game): ?>
<tr>
<td><?php echo $game->mannschaft1; ?></td>
<td><?php echo $game->mannschaft2; ?></td>
<td><?php echo JHtml::date($game->date); ?></td>
<td>Tipp</td>
<td><?php echo $game->goalsteam1; ?> : <?php echo $game->goalsteam2; ?></td>
<td>Punkte</td>
</tr>
<?php endforeach; ?>
</tbody>