Zhimeng dedecms realizes the link of the classified channels on the inner pages

Source: Internet
Author: User
Tags php file

There are three methods:

1: It's a stupid way to create an HTML single page, but it hurts that you need to modify that page every time. This is not in line with our lazy style! So I got along with the second method.

2: explain the method first, and then the principle:

Method: First find the template index.htm on the first page and pull it down. For comparison, you can find {dede: flink row = '24'/} (or {/dede: flink}) and change it to {dede: flink row = '24' typeid = "1 "/}.

Then, on other pages, such as the list page and the code of the homepage link, remember to copy it completely, and then change {dede: flink row = '24'/}

The code is as follows: Copy code
{Dede: flink row = '24' typeid = "2 "/}.

Usage:

When switching the connection on the home page, select 1 comprehensive website for the type, and the corresponding internal page. You need to see your typeid = "? ", Corresponding to your category information, this topic can be slightly modified, call our website Category ID, so that you can truly achieve classification display friendship connection

Classification channel call friendship connection

Find you/behind/templets/friendlink_add.htm and change the website type

The code is as follows: Copy code

<Tr>
<Td height = "25"> website Type: www.111cn.net </td>
<Td>
<Select name = "typeid" id = "typeid">
<Option value = "1"> homepage </option>
<? Php
$ Dsql-> SetQuery ("select * from # @__ arctype ");
$ Dsql-> Execute ();
While ($ row = $ dsql-> GetObject ())
        {
Echo "<option value = '". $ row-> id. "'>". $ row-> typename. "</option> rn ";
        }
?>
</Select>
</Td>
</Tr>

In this way, the website category will be displayed when a friendly connection is added. How can we call the classification page? Add a function to find/include/arc. listview. class. php file, before the end of the class}

The code is as follows: Copy code

Function getlmlink ($ typeid)
 {
$ Tsql = new DedeSql (false );
$ Typelink2 = '<div class = "pcs linkborder"> <p class = "linktitle"> Friendship connection & nbsp; </p> <div class = "links"> ';
$ Tsql-> SetQuery ("select * from # @ _ flink where typeid = '$ typeid '");
$ Tsql-> Execute ('t ');
While ($ row = $ tsql-> GetArray ('t', MYSQL_ASSOC ))
  {
$ Typelink2. = "<a href = '". $ row ['URL']. "'target = _ blank> ". $ row ['webname']. "</a> ";
  }
If (strlen ($ typelink2)> 90)
  {     
Return $ typelink2. "</div> 111cn.net ";
  }
Else
  {
Echo '';
  }
 }

The last step of the code is to add

The code is as follows: Copy code
{Dede: pagelist listitem = "pagefirstlink" listsize = "0 "/}

The result is as follows:

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.