我正在使用 Phil Sturgeon 的模板库 (http://philsturgeon.co.uk),但在将数据传递到部分时遇到问题。
我可以通过执行 $this->template->title('some title')
我想设置其他属性,例如元描述和元关键字,但我不确定如何将其传递给部分。
最佳答案
尝试构建模板并向其传递您需要的所有数据,例如:
$this->data->myTitle = "Your title";
$this->data->myKeyword = "key1, key2";
$this->template->build('your/view',$this->data);
然后尝试将其使用到您的 View 中:
$myTitle
和 $myKeyword
关于php - 如何将数据传递到 Codeigniter 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9621686/