使用Joomla,我設置了模型和視圖,但是當頁面加載時,沒有數據顯示。php - 帶有數據數組的print_r()
型號:
class mlsModelmls extends JModel
{
/**
* Gets the info
*/
function mlsdata($column)
{
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM ".$db->nameQuote('#__mls')."
WHERE ".$db->nameQuote('MSTMLSNO')." = ".$db->quote('4112065').";
";
$db->setQuery($query);
$row = $db->loadRow();
print_r($row[$column]);
}
}
查看:
class mlsViewmls extends JView
{
function mlsnum($tpl = null)
{
$model = &$this->getModel();
$mlsnum = $model->mlsdata(MSTMLSNO);
$this->assignRef('mlsnum', $mlsnum);
$agentuid = $model->mlsdata(MSTLISTBRD);
$this->assignRef('agentuid', $agentuid);
$listdt = $model->mlsdata(MSTLISTDT);
$this->assignRef('listdt', $listdt);
/** Some more assignRef() */
parent::display($tpl);
}
}
TMPL:
<h2 class="price">
<?php echo $this->mlsnum; ?>
</h2>
當頁面加載時,TMPL看起來不錯,但沒有數據顯示的<?php echo $this->mlsnum; ?>
參考呼叫。
每個assignRef()
是否需要它自己的功能?
更改的,現在我得到了一個服務器錯誤頁面。 – Plummer
對不起,放置';'在返回$ row [$ column] – Ronn0
之後,我看到了,但後來我的ISP掉線了,我無法對評論進行編輯。現在TMPL再次出現,但仍然沒有數據。 – Plummer