There are pages in the view Description,keywords,contact,etc .... These are in the database,
How can I write it in one place and call it in a template?
keywords;?>
For example, you can output keyword information without writing it in each controller
Reply content:
There are pages in the view Description,keywords,contact,etc .... These are in the database,
How can I write it in one place and call it in a template?
keywords;?>
For example, you can output keyword information without writing it in each controller
You can use 类库参考
the»» 加载器类
vars
method in
Document Address
Use the method in my_controller.php to construct the method:
$this->load->vars('yourglobalvars','yourvalues');
All of your controllers 继承
MY_controller
so that you can use this variable in all view templates that inherit the controller.
yourglobalvars;?>
Can be placed in the cache and then pulled directly from the cache
You can try trait
it and use it for reusable blocks of code, in detail to seephp手册
The custom class then puts the data in the database to set the class to load automatically
Refer to my blog to write an article
Link
$this->load->view () directly in the view.