1. Em vừa code tới đoạn này thì bị lỗi :
Code: Select all
$document = & $this;
$comUrl = $document->baseurl . '/components/com_quanlydiem';
$temp = $comUrl.'/assets/images/';
function _getButton($link,$image,$name){
?>
<div style="float:left;">
<div class="icon">
<a href="<?php echo $link; ?>">
<img src="<?php echo $temp/*lổi cái chổ này*/ . $image ; ?>" height="60px" width="60px" alt="<?php echo $name; ?>" />
<span><?php echo $name; ?></span></a>
</div>
</div>
<?php
}
_getButton("index.php?option=com_quanlydiem&view=hss","Borsalino-icon.png","Học Sinh");
?>
Code: Select all
<img src="%3Cbr%20/%3E%0A%3Cb%3ENotice%3C/b%3E:%20%20Undefined%20variable:%20temp%20in%20%3Cb%3EC:%5Cwamp%5Cwww%5CActiveEnglish%5Cadministrator%5Ccomponents%5Ccom_quanlydiem%5Cviews%5Cquanlydiems%5Ctmpl%5Cdefault.php%3C/b%3E%20on%20line%20%3Cb%3E11%3C/b%3E%3Cbr%20/%3E%0ABorsalino-icon.png" alt="Học Sinh" width="60px" height="60px">
2.Em dùng mô hình mvc trong cái hướng dẩn com_hello để viết com_quanlydiem :
- ở Model em có file diems.php chứa phương thức select :
Code: Select all
function _buildQuery($id) // chổ quan trọng ở đây
{
$query = ' SELECT * '
. ' FROM #__diem where mahs = $id '
;
return $query;
}
function getData()
{
// Lets load the data if it doesn't already exist
if (empty( $this->_data ))
{
$query = $this->_buildQuery();
$this->_data = $this->_getList( $query );
}
return $this->_data;
}
Code: Select all
function display($tpl = null)
{
JToolBarHelper::title( JText::_( 'Quản lý điểm' ), 'generic.png' );
JToolBarHelper::deleteList();
JToolBarHelper::editListX();
JToolBarHelper::addNewX();
JToolBarHelper::custom( 'import', 'new.png', 'new_f2.png', 'Import điểm',false );
// Get data from the model
$items = & $this->get( 'Data');// chổ quan trọng ở đây
$this->assignRef('items', $items);
parent::display($tpl);
}
Code: Select all
$items = & $this->get( 'Data');// chổ quan trọng ở đây
Giúp em với ! sắp đến thời hạn nộp đề án rồi mà em chưa code được gì hết , anh chị nào hay hay xin giúp với ! Em cám ơn trước !!!!