public function hookDisplaySlider() {
$this->context->smarty->assign('test', "test");
// $sql = 'SELECT * FROM '._DB_PREFIX_.'slider';
// $result = Db::getInstance()->getValue($sql);
// $this->context->smarty->assign('query_results', Db::getInstance()->getValue($result));
return $this->display(__FILE__,'views\templates\hook\dplus_slider.tpl');
}
我的文件smary
<p>{$test}</p>
我的tpl文件正确读取了html代码,但无法读取我可以放入其中的变量
尝试一下:
$this->context->smarty->assign(array(
'test' => "test"
));