Dedecms list page and content page call the top-level topic ID method

Source: Internet
Author: User
The method for adding top-level topic IDs in the Zhimeng template is summarized. using dede top-level topic IDs can achieve many functions, such: call different topic images on each list page (the same picture is called for the same top-level topic ),

The method for adding top-level topic IDs in the Zhimeng template is summarized. using dede top-level topic IDs can achieve many functions, such: call different column pictures on each list page (the same picture is called for the same top-level column). if we create N columns, we need to create N List page templates, this method is not desirable. how can we solve this problem faster and more simply? the idea of the dede template is as follows: call the top-level column ID, then add the image tail as the ID number, for example, img1.jpg, that is, imgid.jpg. in this case, we only need to create an image. this is probably the case, the following describes how php exclusive network collects data on the network:

Dede Method 1:

{dede:field.typeid function="GetTopid(@me)"/}

This method is feasible after testing.

Dede Method 2:

First, add the tag syntax where you need to call the top-level topic ID.

{dede:type}[feild:topid/]{/dede:type}

Second, modify the source file and find type. lib. php under the taglib directory under the include directory.

Find this statement

$row = $dsql->GetOne(“Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepathFrom `dede_arctype` where id=’$typeid’ “);

Changed

$row = $dsql->GetOne(“Select id,topid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepathFrom `dede_arctype` where id=’$typeid’ “);

In if (! Is_array ($ row) return "; add the following row

if( $row['topid']==0){$row['topid']=$row['id'];}

In this way, this statement can be called in top-level columns or subcolumns.

This method looks good and you can modify the source code. However, after my test, I found that it didn't achieve the desired effect, so I didn't use it. if you are interested, you can test whether it is feasible.

The above is a small summary of how php lexnet adds the top-level topic id to the dede dream template. You are welcome to test and pay attention to it. if you have any new methods, please share them, you can leave a message in my comments.

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.