我想知道如何将数据从joomla视图传递到joomla模板。我如何传递多个变量?
class CareerformViewCareerform extends JView
{
protected $state;
protected $item;
function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get some data from the models
$state = $this->get('State');
$item = $this->get('Item');
$newvar="Something";
$success_message="Thanks for your interest";
parent::display($tpl);
}
}
我想把$newvar
和$success_message
传递给模板;我怎样才能通过考试呢?
我们可以使用:
$var1="Some string";
$this->assignRef('var1',$var1);
请注意,assignRef
通过引用传递第二个参数,我们可以将其检索为
echo $this->var1;
不仅是$var1
,而且是$this->var1