Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using different templates on the first page of dream-weaving DEDECMS list page and other pages

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Dream DEDECMS list page home page and other pages to use a different template method? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Dream DEDECMS list page how to use a different template from other pages?

The method of using different templates on the first page of dream-weaving DEDECMS list page and other pages

Recommended study: dream weaving cms

Sometimes we need to make the first page of the list page different from the second page and the following page, and it is difficult to modify the dede:list tag to achieve the desired results, then Dream Weaving Cat introduces the easiest way is to specify a separate template page for the first page, and call another template page for the rest of the page.

The method of modification is as follows:

Open the arc.listview.class.php file in the include directory, find the Display function (about line 397), and find the following code:

$this- > ParseTempletsFirst ()

Add the following code at the top of these codes:

If ($this- > PageNo > 1) {$tempfile = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']. "/". $GLOBALS ['cfg_df_style']. "/ list_article2.htm"; $this- > dtp- > LoadTemplate ($tempfile);}

After it is added, when the number of pages is greater than 1, Dream Weaving will call list_article2.htm as the list page template.

After adding the above code, it can be achieved when browsing the column dynamically, but you will find that after generating the static HTML page of the column, it still does not achieve the desired goal.

Search for the following code:

$this- > ParseDMFields ($this- > PageNo,1)

Add the following code at the top of this code:

If ($this- > PageNo > 1) {$tempfile = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']. "/". $GLOBALS ['cfg_df_style']. "/ list_article2.htm"; $this- > dtp- > LoadTemplate ($tempfile); $this- > ParseTempletsFirst ();}

Well, now both static and dynamic pages have achieved the desired results.

There may also be questions: if a column has multiple list page templates, does the second page of each column list page use list_article2.htm as the template?

Solution:

Set

$tempfile = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']. "/". $GLOBALS ['cfg_df_style']. "/ list_article2.htm"

Change to:

$tmpdir = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']; $tempfile = str_replace ("{tid}", $this- > TypeID,$this- > Fields ['templist']); $tempfile = str_replace ("{cid}", $this- > ChannelUnit- > ChannelInfos [' nid'], $tempfile); $tempfile = $tmpdir. "/". $tempfile; $tmpfile2 = substr ($tempfile,0,-4); $tempfile = $tmpfile2. "2.htm"

Now you will automatically get the template with 2 added to the list page template. For example, if the template for the list page is list_image.htm, then the template for the second page is list_image.htm.

Thank you for reading! After reading the above, do you have a general idea of how to use different templates on the front page of the dream weaving DEDECMS list page and other pages? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report