Weaving dream Dedecms The first page of the list page and other pages to use a different template approach

Source: Internet
Author: User

Sometimes we need to make the first page of the Dream List page and the second page and the following page to show the effect of different, using different templates, but there is no other better online solutions, then the following the Dream Technology Research Center to introduce you to the simplest way, By modifying the file to specify a single template for the first page of the column list page, the remaining pages call another template.

The specific modified files and code are as follows:

First, locate and open the include/arc.listview.class.php file, locate the display function in the location of the No. 397 line, and find the following code:


$this->parsetempletsfirst ();

Add the following code to 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);

}

The above code is to determine that when the list of pages is greater than 1 o'clock, the dream will call list_article2.htm as the current list page template.

Second, add the above code, in the Dynamic browsing column has been able to successfully implemented, but will generate columns static HTML page, still can not call normal, and need to continue to modify. We continue to find the following code in the include/arc.listview.class.php file:


$this->parsedmfields ($this->pageno,1);

Add the following code to 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 ();

}

After the modification here, both the static page and the dynamic page can achieve the desired effect.

Third, but if more than one content model uses multiple list page templates, then the second page of each content model's Column list page will use list_article2.htm as the template, so we need to modify it as follows:

Take step 1th and step 2nd in the following code:


$tempfile = $GLOBALS [' Cfg_basedir ']. $GLOBALS [' Cfg_templets_dir ']. " /". $GLOBALS [' Cfg_df_style ']." /list_article2.htm ";

Modified 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;

$tmpfile 2 = substr ($tempfile, 0,-4);

$tempfile = $tmpfile 2. " 2.htm ";

The system will automatically get the current Content Model List page template with 2 of the template, the first page of the example set List page template is list_image.htm, then the second page of the Atlas template is list_image2.htm, so it is more convenient.

Weaving dream Dedecms The first page of the list page and other pages to use a different template approach

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.