Discuz template statement analysis and knowledge skills
1. Template calling
For example, in a template, if you want to call the content in another template, you can use the following statement:
{template xxx}
Suppose that a new template named "abc.htm" is created. When the background template is edited, it will only be displayed as "acb". If you need to call it in the index, then add {template abc} to the appropriate position in the index and it will be automatically used.
Related examples: In the index template, there is {template header} at the top and {template footer} at the bottom.
Related questions:
Then in this abc template, there needs to be
Unnecessary! Just write whatever you want to display, because it is only a part of the entire web page! are already in the header and footer templates.
2. Fixed parameters
$seohead --- Header information of background settings
$charset --- The language character set is set in config.inc.php. It is essential and cannot be deleted!
$extrahead --- Control forum automatic jump parameters, essential, cannot be deleted!
{eval updatesession();} --- Update the parameters of the forum session table. It is essential and cannot be deleted!
{eval output();} --- End the forum output, it is essential and cannot be deleted!
The above parameters are based on Discuz! 4.0. These parameters will vary according to different versions!
There are also some parameters of $xxx. If you are not a plug-in author or program developer, please do not modify them randomly!
3. Data Judgment
1. You will often see xxxxx statement.
These are not comments in ordinary HTML, but Discuz!'s unique template judgment syntax, just like if, else, then, etc. in PHP or other syntaxes.
Through these syntaxes, different template effects can be achieved.
Related examples:
Copy content to the clipboard in header templateCode: --- If $discuz_uid is obtained, the following information will be displayed ( Judgment 1)
$discuz_userss: {langlogo ut}
--- If there is $maxpmnum, the following information will be displayed, otherwise it will not be displayed (Judgment 2)
| {lang pm }
--- Ended this judgment (judgment 2)
| {lang memcp}
--- If $adminid is within the range of 1,2,3 , that is, the following information will be displayed, otherwise it will not be displayed (Judgment 3)
| {lang admincp}
--- Ended this judgment (Judgment 3)
--- If $discuz_uid cannot be obtained, the following information will be displayed
{lang guest}: {lang register}
| {lang login}
--- End this judgment (judgment 1)
This is a loop statement, which will automatically end until the data is output.
Through these syntaxes, the same series of data can be displayed in a loop.
Related examples:
Copy content to the clipboard in
--- Loop 2 starts, judge the plug-in module
| $module[url]
--- End loop 2
--- End loop 1
In the template , you often see statements like {lang xxx}. It is used to call words in the language package.
Most of the things that are called in templates are templates.lang.php.
Let’s take a look at the structure of the language pack:
-- Announce the start of the php language
$language = array
( --- The above announcement is the start of the language pack definition
'title' => 'title',
Call characters to display text
'never' => 'Never',
Call the character to display text
....
); --- Declare the end of the language package definition
?> -- Declare the end of the php language
Related examples:
Suppose we add a language call, Add
'abc' => 'This is a test language call' in the line above
'title' => 'Title',
The last one is indispensable, as well as the calling characters and display text, both Must be quoted using ''.
After adding it, you can call it in the template. Write {lang abc} in the template
Then it will be displayed directly: This is a test language call
Special note: After adding a language or modifying a language package, the cache must be updated oh!
5. Style Parameter Calling
The statements {XXXXX} are often seen in templates. {} must be in uppercase letters.
These are the parameters in the calling style color scheme. You can add it yourself, the method is as follows:
1. Enter the interface style-> Interface style-> the style point where you want to add parameters [Details]
2. At the bottom after entering, there are two columns to fill in, one is variables , one is to replace the content
Related examples:
Write FOOTERCOLOR for the variable (note that you must use uppercase letters)
Write #003399 for the replacement content
After submission, modify the template and write Test style in the template Custom variable
The result is that this test style custom variable will be displayed according to the color of the filled-in replacement content.
After what has been said above, you should know a lot about what you need to pay attention to or what can be applied when modifying the template!
Hope it is helpful to you. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

Regarding PPT masking, many people must be unfamiliar with it. Most people do not understand it thoroughly when making PPT, but just make it up to make what they like. Therefore, many people do not know what PPT masking means, nor do they understand it. I know what this mask does, and I don’t even know that it can make the picture less monotonous. Friends who want to learn, come and learn, and add some PPT masks to your PPT pictures. Make it less monotonous. So, how to add a PPT mask? Please read below. 1. First we open PPT, select a blank picture, then right-click [Set Background Format] and select a solid color. 2. Click [Insert], word art, enter the word 3. Click [Insert], click [Shape]

C++ template specializations affect function overloading and rewriting: Function overloading: Specialized versions can provide different implementations of a specific type, thus affecting the functions the compiler chooses to call. Function overriding: The specialized version in the derived class will override the template function in the base class, affecting the behavior of the derived class object when calling the function.

Discuz Editor: An efficient post layout tool. With the development of the Internet, online forums have become an important platform for people to communicate and share information. In the forum, users can not only express their opinions and ideas, but also discuss and interact with others. When publishing a post, a clear and beautiful format can often attract more readers and convey more accurate information. In order to facilitate users to quickly type and edit posts, the Discuz editor came into being and became an efficient post typesetting tool. Discu

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

Detailed explanation of the steps to modify the Discuz domain name. Specific code examples are required. With the development and operation of the website, sometimes we need to modify the domain name of the Discuz forum. This may be due to brand change, website SEO optimization, or other reasons. No matter what the reason is, modifying the Discuz domain name is a process that requires careful operation. Today we will introduce the steps of modifying the Discuz domain name in detail and provide specific code examples. Step 1: Back up data. Before modifying the domain name, you must first ensure that the website

Discuz Editor: A powerful web page editing tool that requires specific code examples. With the development of the Internet, website construction and content editing have become more and more important. As a common web page editing tool, Discuz editor plays an important role in website construction. It not only provides a wealth of functions and tools, but also helps users edit and publish content more conveniently. In this article, we will introduce the features and usage of the Discuz editor, and provide some specific code examples to help readers better understand and use

In the Discuz forum, the navigation bar is one of the parts that users often come into contact with when visiting the website. Therefore, customizing the navigation bar can add a unique personalized style to the forum and improve the user experience. Next, we will introduce how to personalize the navigation bar in the Discuz forum and provide specific code examples. First, we need to log in to Discuz's backend management system and enter the "Interface" -> "Navigation Settings" page. On this page, we can perform various settings and customizations on the navigation bar. Here are some
