How to apply themes in thinkphp5:
Configuration items:
'DEFAULT_THEME'=>'default',//默认主题 'THEME_LIST'=>'default,theme',//主题列表 'TMPL_DETECT_THEME'=>true//开启自动侦测模版主题
Related recommendations: "ThinkPHP Tutorial》
Write like this in the action:
$this->theme('theme');//要调用的模版主题名字$this->display('index:index');
Of course, you can also make a function to let users choose the theme themselves, which is achieved by modifying the default theme of the configuration item; it can also be changed dynamically through the t parameter Theme, url?t=theme, and will be automatically saved to cookies.
The usage of the display method for calling templates across independent groups is:
$this->display('admin@index:index);
admin is the group name, index:index are the module name and operation name respectively.
The above is the detailed content of How to apply themes in thinkphp5. For more information, please follow other related articles on the PHP Chinese website!