Dedecms page Template Authoring

Source: Internet
Author: User

A Web page template is an HTM file in Templets, so writing a template is about writing HTML. This article is not about the specific use of tags, but rather a few understanding of Web templates. Includes basic label syntax, cover page templates, list templates, and document template relationships.

One about labels

DEDECMS Tags: just like HTML tags, it's just a dream custom, consisting of tag names, attributes, and innertext.

Overwrite file templets/index.htm

Site name: {Dede:global name=cfg_webname/}<br/><br/><strong> recently landed member </strong><br/>{dede: Memberlist row=6 signlen=30}     <a href= "[field:spaceurl/]" target= "_blank" >         [field:uname/]<br/>    </a>{/dede:memberlist}

View the results by running the site home page index.php.

Like Dede:global is the tag name, Name=cfg_webname is the attribute, between the dede:memberlist tag is innertext. In the weaving dream, innertext is also called the bottom template.

Short Label: A single-sided label, such as Global, is called a short label, which represents the value of an element.

Block Tags: like memberlist, this pair of labels called Block labels, generally represents a series of records, like the above code is a list of 6 members of the dictation information. Research will find that these records come from the database.

[Field:xx] This represents a property value in the record.

Summarize what languages are used to write the template

HTML code + new DEDECMS tag syntax.

CSS and JS have no new syntax and are called in the form of an external file.

The code for Php,mysql is greatly reduced, and part of the code related to database queries is replaced by the tag syntax. For example, calling the Memberlist tag is equivalent to accessing the data table Dede_member. PHP is mainly used to write and modify new modules such as plugins.

The above is just a description of the Dream label Grammar, to write Web templates, you should learn dedecms tags, see the template manual.

Marking Manual 1

Marking Manual 2

Webmaster Encyclopedia

Learn Global, field, PHP, Arclist, List, pagelist and memberlist without all the tags. Other needs to be checked again.

To learn a label, learn to
1 basic syntax of the tag, label signature
2 tags, tags corresponding to the page template, and the logical meaning of the label
3 properties of the tag and its control over label usage
4 The data source behind the tag and the innertext it provides

Types of two templates

2.1 Templets Folder

The system folder, which contains the default underlying template. When we do not write anything between block-level tags, it is automatically used as a block-level label innertext.

Plus folder, which contains templates that are called by PHP in Root_dir/plus. After some research may be able to imitate the code of these templates, to be explored.

The default folder, which is placed in the defaults template, is the main template for Web page display, if the next other Dedecms template (unofficial default template), may be inside just a templets folder, because this is enough for the appearance. The following is an analysis of the default folder.

I used to use only index.htm, what is the use of other documents?

I think these files can be divided into two categories:

The first class is not a complete page, which is include (because of the DEDECMS tag, the HTML document can also include). such as head.htm,footer.htm and so on.

The second category is the complete page, hehe.

And the second category is divided into cover (index) template, list template, document (content, article) template. The index_xx.htm in the folder is the cover page template, and so on.

2.2 Testing of cover, list, and document templates

Change the path to DirName (__file__) in Settemplet at root_dir/index.php. "/templets/default/

List_article.htm ", the content displayed is not quite complete. How do you use these templates? The way I explored it:

Open DEDECMS Web site management (yes, install the installation Data Experience Pack first, so that test data will be tested)

Click on the Site column management

Change the midpoint in the Web base

The section property in the general options is the channel cover

Then select advanced Options

The cover page template for the advanced option is {style}/index_article.htm

If you install the data and I am the same version, you will know that the Web base is a one-level column, the bottom of a lot of articles organized.

Back to website column management

Click on the preview and you will see a page about the basic page. Because the column properties in the General options are channel cover, the Advanced option has the cover page template {style}/index_article.htm, so the Web pages call index_article.htm as a template.

And so on, if the column property is the final list column in the General options, the cover page template in the Advanced option is {style}/list_article.htm, then list_article.htm is called as the template, and so is the document template.

The relationship between templates and columns

Each column has its own three templates, and the same template can be used by multiple columns. In other words, the template simply provides a style, but the content comes to the database. This also explains why the path to Settemplet in root_dir/index.php does not display the full content because the template is not bound to a specific column. This is also a dream as a content management system features, the style and content separation.

Again, the document template, which is seen in the section properties, General Options. It is not possible to publish articles as a channel cover section. Let's choose a final list column, like "Html"

Click Change. See the General options in the Column property is the final list column, point advanced options, you can see the document template {style}/article_article.htm, so all the articles under the HTML column will be displayed in this template.

Click the general article in content management

Select an article under the HTML column, click the Preview (the green ball on the right)

What you see here is the style represented by the article_article.htm template.

Here, you should see how the cover page template, list template, and document template will be displayed/debugged.

Channel 2.3

It is important to see that most of the templates in Templets/default are in these three categories. Then there is index_article.htm,list_article.htm,article_article.htm enough, and the others do.

This is about the channel, channel is the type of the column, the article (article) channel, image (image) channel, software (soft) channel (essentially a download channel), product (shop) channel. Channel is a content model, such as animation, landscape can use the picture channel. So there will be Index_article.htm,index_ image.htm,index_ soft.htm,index_shop.htm. Each channel has its own three types of templates.

So how to write a template , of course, you must first learn the tag syntax

A, function extension, such as {dede: Tag name function= "function name (@me, other parameters)"/}

B, direct programming in innertext, that is, the method that has been used before

Read the index_article.htm,list_article.htm,article_article.htm again. Reading the source code is the best way to learn ^_^

In general, the specific thing to do is to write a Web page template for each channel.

The content of the template is shared here.

(ext.) dedecms page Template Authoring

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.