Discuz template statement analysis and knowledge tips _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Discuz template statement analysis and knowledge skills. I. template calling. for example, if you want to call the content in another template, you can use the following statement: {templatexxx} to create a new template named abc. ht. I,Template Call
For example, to call the content in another template, you can use the following statement:
{Template xxx}
Assume that a new template named "abc.htm" is created. BackgroundOnly "acb" is displayed when the template is edited. you need to call it in the index, so add {template abc} to the appropriate position in the index}
Then it will be replaced automatically.

Related instances:In the index template, {template header} is at the top and {template footer} is at the bottom}
Related questions:
In this abc template, you must have?
No! Write what you want to display, because it is only part of the entire web page!They are already in the header and footer templates.


2. fixed parameters
$ Seohead --- background SetHeader information
$ Charset --- setting the language character set in config. inc. php is required and cannot be deleted!
$ Extrahead --- control ForumAutomatic jump parameters are required and cannot be deleted!
{Eval updatesession () ;}--- update the parameters of the Forum session table. this parameter is required and cannot be deleted!
{Eval output () ;}--- ends Forum output. it is required and cannot be deleted!

The preceding parameters are as follows: Discuz ! 4.0. these parameters vary with different versions!
Some $ xxx parameters, such Plug-insAuthor or ProgramDo not modify it in disorder during development!


III,DataJudgment
1. it is often seen in templates. Xxx Xx .
These are not common HTML But Discuz! The unique template judgment syntax is like Php Or Others If, else, then, and so on in the syntax.
These syntaxes enable different templates Effect.

Related instances:
Header Template

Copy content to clipboard Code : --- If $ discuz_uid is obtained, the following information is displayed (judgement 1)
$ Discuz_userss: {langLogoUt}

--- If $ maxpmnum exists, the following information is displayed; otherwise, the information is not displayed (judgement 2)
| {Lang pm}
--- End this judgment (judgment 2)

| {Lang memcp}

--- If $ adminid is within the range of 1, 2, and 3, the following information is displayed; otherwise, the information is not displayed (Judge 3)
| {Lang admincp}
--- End this judgment (judgement 3)

--- If $ discuz_uid cannot be obtained, the following information is displayed:

{Lang guest }:{ lang register}
| {Lang login}

--- End this judgment (judgement 1)

2. it is often seen in templates. Xxx .
This is a loop statement, which ends automatically until the data output is complete.
Through these syntaxes, you can display the data of the same series cyclically.

Related instances:
Header Template

Copy content to clipboardCode: --- Start with Loop 1 and judge the plug-in
--- Start with loop 2 to determine the plug-in module
| $ Module [url]
--- End loop 2
--- End loop 1

IV. language calls
In the template, statements such as {lang xxx} are often seen. It is used to call words in the language pack.
Most of the calls in the template are templates. lang. php.
The structure of the language pack is as follows:

Copy content to clipboardCode: $ Language = array
(--- The definition of language pack has been announced above

'Title' => 'title ',
Call character display text
'Never '=>' never ',
Call character display text
....
) --- End the language pack definition
?> -- End the php language

Related instances:
Assume that we add a language call in
'Title' => 'title ',
Add in the previous line
'ABC' => 'this is a test language call ',
Finally, the call character and display text must be.
After adding it to the template, you can call it and write {lang abc} in the template}
It is displayed as follows: this is a test language call.


Note: after adding a language or modifying a language pack, you must update the cache!


V,Style Parameter call
The {XXXXX} statement is often seen in the template. {} Must be in uppercase.

These are parameters in the style color scheme. You can add it by yourself,Method As follows:
1. choose interface style> style of the parameters you want to add. [details]
2. enter at the bottom of the page. you can enter two columns: variable and replacement.

Related instances:
Variable to write FOOTERCOLOR (note that uppercase is required)
Replace content write #003399
After submission, modify the template and write test-style custom variables in the template.
Then, the custom variables of the Test style are displayed according to the color of the replaced content.
As mentioned above, you should be aware of the things you need to pay attention to when modifying the template or apply them to it!

Hope to help you, Enjoy It!

For example, if you want to call the content in another template, you can use the following statement: {template xxx} to create a new template named "abc. ht...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.