Home > CMS Tutorial > DEDECMS > body text

DedeCMS's special feature of dream weaving

(*-*)浩
Release: 2019-11-18 16:33:17
Original
3003 people have browsed it

A website usually launches some targeted thematic content at different periods. The function of the theme is actually to retrieve the content of the site according to specific needs and integrate these different forms of content. We can take a look at this. Some large portals, such as Sina and Sohu, have their own special channels.

DedeCMS's special feature of dream weaving

A topic can contain content from several different columns or different content models such as: articles, pictures, audios, videos, etc. Different topics You need to have your own page style that matches the environment at that time. For example, on New Year's Day and New Year, you need red-themed thematic templates, and in spring and summer, you need green-themed thematic templates. (Recommended learning: dedecms tutorial)

A good topic can easily allow website members to understand the relevant information more comprehensively to enhance attention to the website. Below we introduce how to use it Use the topic function of DedeCMS to create a topic.

We log in to the backend as a super administrator and manage the topic in the [Core]-[Topic Management] of the system.

DedeCMSs special feature of dream weaving

Because the common management here is similar to document management, some common operations such as adding, deleting, updating, and recommending will not be described here. This tutorial mainly introduces how to Create your own topic page by combining topics with template files.

To make a topic page, you need to prepare two things: content and template. Of course, if you do not have a template file designed by yourself, the system comes with a set of topic page styles by default, which can be used in the background [Core ]-[Content Model Management], click on the topic type template and you will see the following content:

文档模板:/templets/default/article_spec.htm [修改]
列表模板:/templets/default/list_spec.htm [修改]
频道封面模板:/templets/default/index_spec.htm [修改]
Copy after login

Users can make global unified modifications to these default template files by themselves, but generally they are done when adding topics. Specify it in the "Topic Template" of the general parameters.

Of course, there are some topics that do not need to use content that has been published in the content management system. Such topics can be completed directly using static pages and do not require tags to be called, but they want to be displayed in the topic list. In order to solve this problem, it is recommended that users make the topic page a template file without tags when making the topic page, and then specify the template when adding the topic.

Next, we will introduce how the special functions of Dreamweaver are divided.

As you can see, admin5's topics are generated using a unified topic template. This type of topic only requires the website administrator to choose to organize the topic content of the website, and then publish it to present this type of topic. Website topics. The chinaz topic uses an independent template file, which makes the topic more distinctive and the reading effect more obvious.

DedeCMS comes with a template file for the topic page that can meet most people’s requirements for the topic. Let’s introduce how to use the default template file to create a topic.

Log in to the system backend as a super administrator, enter the topic management page, and click [Add Topic] to enter the topic addition page.

Add the topic name, responsible editor, topic description, keywords, and main category of the topic to the general parameters, and then enter the "Topic Document" tab to select the content of the relevant topic node.

Before adding, let’s understand a concept: nodes.

The so-called node is a combination of the same classified content in a topic. As shown in the figure below, there are two nodes: Coreldraw 9 Quick Tutorial and Coreldraw 9 Tutorial Summary. Each node selects some articles in the system. .

DedeCMSs special feature of dream weaving

Adding the above two nodes can be added in two ways in the system settings. The first is to specify the article list and "select node articles" in a single node. This method more accurately specifies the content of the topic node, and is the first choice when the node content is small.

The second method is to automatically obtain documents. In this method, you only need to enter the "keyword" of the node to automatically search for the content of articles containing keywords and add them to the content list.

DedeCMSs special feature of dream weaving

In this way, we have completed the addition of the topic content and published a topic in this form. The style of the topic page is the system default system style. Next we Let’s introduce how to use the topic template tag to create a special topic page.

To create a special template page on the homepage, you need to understand some basic concepts of the Dreamweaver template engine. You need to know what a template engine is and the use of some Dreamweaver template tags. If you can use arclist tags here, you can basically You can create your own theme template.

There are two template files involved in the topic:

/templets/default/article_spec.htm 专题模板文件,这个模板决定你的网站专题页面的样式,是制作模板页面必备的文件
/templets/system/channel_spec_note.htm系统底层的专题节点模板,在制作节点的时候需要对其进行一定的修改
Copy after login

这两个文件是决定你专题样式的模板重要文件,当然这里还有一个底册模板(innertext),这个底层模板在每个节点处都可以单独指定。

这里还需要用户知道的一个专题节点的模板标签:{dede:field.note noteid='识别ID'/},这个标签是用来生成专题页面的文档列表的。

设计专题页面模板

我们首先用网页制作相关工具来设计一个专题页面的模板文件,当然我们这里因为是做一个示例,重点是讲解如何从页面到模板文件这个过程,所以模板文件的样子比较简单,如果是专业的美工人员,可以设计出各式各样专业的模板文件。

我这里只是在网页制作工具中使用Dreamweaver制作出一个专题模板的样子,专题主要分为2个部分,专题内容简介以及节点文章,当然这里专题的内容简介我已经固化在了专题模板文件中,用户也可以使用模板标签{dede:field name='description'/},然后在后台添加专题简介中完成。

DedeCMSs special feature of dream weaving

加入专题页模板标签

从上面的内容我们知道,织梦的模板需要在页面中加入织梦模板标签后才能完成制作,接下来我们来加入模板标签。在加标签之前,我们先将上面设计出来的模板文件保存为:

/templets/default/article_spec2_templets.htm,保存完成以后我们可以修改这个页面,加入标签,使其变成专题页面的模板。

首先我们加入常用标签:{dede:field.title/}_{dede:global.cfg_webname/}

这个标签是加入在模板文件之前,用于解析成为专题标题的,{dede:field.title/}代表是你在后台添加的专题名称,{dede:global.cfg_webname/}指的是你的网站名称,经过织梦的系统解析后成为:DedeCMS V5.3相关内容专题_织梦非官方演示站点

当然,在seo方面可以在和之间加入以下代码

<meta name="keywords" content="{dede:field.keywords/}" />
<meta name="description" content="{dede:field.description function=&#39;html2text(@me)&#39;/}" />
Copy after login

这个代码就是将你在添加专题时候设置的关键字以及专题说明添加进页面。

接下来最重要的就是专题节点部分的添加了,因为节点部分主要是列表,所以涉及到一个底层模板(innertext)的概念,底层模板在织梦的标签语法简介中已经有相关说明。

因为我们从模板文件中可以找出单挑记录循环的内容为:

<tr>
<td>站长学院<a href="#" target="_blank">dedecms列表页title优化方法</a></td>
</tr>
Copy after login

所以我们根据arclist的相关标记可以得到底层模板(innertext):

<tr>
<td>[field:typename/]<a href="[field:arcurl /]" target="_blank">[field:title /]</a></td>
</tr>
Copy after login

这个底层模板我们在添加节点的时候可以进行指定

DedeCMSs special feature of dream weaving

接下来我们在节点部分加入节点标签{dede:field.note noteid='标识'/},因为我们这里有2个节点名称,标识ID分别为: use(使用介绍)、exp (体验说明),所以我们替换模板页面中循环部分:

<table width="100%"    style="max-width:90%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="2%" bgcolor="#66CC66">使用介绍</td>
            <td width="98%" align="left"><table width="80%" border="0" cellpadding="0" cellspacing="3" id="nlist">
{dede:field.note noteid=&#39;use&#39;/}
            </table></td>
          </tr>
        </table>
Copy after login

这样一来,我们的专题模板就制作完成了,我们将其另存文件名为:

/templets/default/article_spec2.htm,这个文件就是我们的专题模板文件。
Copy after login

修改节点容器模板

在我们上面设计的模板中,有2个节点,因为我们其中有一部分内容已经固化在模板中,所以如果直接发布内容,会出现多出了节点标题的情况,一个节点生成为页面的时候,DedeCMS会读取他的节点容器模板,所以我们需要对节点容器模板进行一些修改,我们打开/templets/system/channel_spec_note.htm这是默认的节点容器模板。

                     <dl class="tbox">
                            <dt><strong>~notename~</strong></dt>
                            <dd>
                                   <ul class="d1 ico3">
                           ~spec_arclist~
                                   </ul>
                            </dd>
                     </dl>
Copy after login

这里需要介绍2个标记:~notename~和~spec_arclist~

~notename~ 节点的名称,在系统解析时候会在节点中将这个标签解析为当前设置的名称
~spec_arclist~ 节点内容列表,系统读取底层模板文件,并解析成节点设置的内容同这个标记进行替换
Copy after login

这个节点容器解析后的内容再同{dede:field.note noteid='标识'/}标记进行替换,完成模板的解析,所以我们在这里需要对其进行一些修改,因为前面设计时候的节点名称已经固化在模板文件中,所以这里不涉及到这部分的内容。我们只要将冗余部分的代码去除,直接使之变为:

~spec_arclist~
Copy after login

如果不想影响到其他模板文件的使用我们将其另存为:

/templets/system/channel_spec_note_dedecms.htm
Copy after login

我们在添加专题时候可以独立设置为:

DedeCMSs special feature of dream weaving

至此我们完成了专题页面模板文件的制作,接下来做的只需要像上面所说的一样,直接选取相应的内容添加节点发布即可。

The above is the detailed content of DedeCMS's special feature of dream weaving. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!