Home > PHP Framework > ThinkPHP > How to apply themes in thinkphp5

How to apply themes in thinkphp5

爱喝马黛茶的安东尼
Release: 2019-08-23 11:25:28
Original
2615 people have browsed it

How to apply themes in thinkphp5

How to apply themes in thinkphp5:

Configuration items:

'DEFAULT_THEME'=>'default',//默认主题    
'THEME_LIST'=>'default,theme',//主题列表    
'TMPL_DETECT_THEME'=>true//开启自动侦测模版主题
Copy after login

Related recommendations: "ThinkPHP Tutorial

Write like this in the action:

$this->theme('theme');//要调用的模版主题名字$this->display('index:index');
Copy after login

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template