DEDECMS Enhancement Deputy Column function program code

Source: Internet
Author: User
Tags foreach php file strlen trim

List Page Modifications:

Add a label to the list_article.htm page [field:typeid2llink/] to get the secondary column connection.

Modify the include/arc.listview.class.php file and add it below 875 lines:

The code is as follows Copy Code


$ks = Split (', ', $row [' Typeid2 ']);

$type 2name= "";

foreach ($ks as $k) {

$k = Trim ($k);

if ($k!= "") {

if ($rows = $this->dsql->getone ("Select *,id as Id1 from ' #@__arctype ' where id=". $k)) {

$type _path=gettypeurl ($rows [' Id1 '],mftypedir ($rows [' Typedir ']), $rows [' IsDefault '], $rows [' DefaultName '], $rows [' Ispart '], $rows [' Namerule2 '], $rows [' SiteURL ']);

$type 2name.= "<a href=". $type _path. "' target=_blank> '. $rows [' TypeName ']." </a> ";

}

}

}

$row [' Typeid2llink '] =substr ($type 2name,0,strlen ($type 2name)-1);

OK, the list page can be displayed.

Content Page Modification:

Add a label {dede:field.typeid2llink/} to the article_article.htm page to get the secondary column connection.

Modify the include/arc.archives.class.php file and add it after line 125:

The code is as follows Copy Code


$ks = Split (', ', $this->fields[' Typeid2 '));

$type 2name= "";

foreach ($ks as $k) {

$k = Trim ($k);

if ($k!= "") {

if ($rowa = $this->dsql->getone ("Select *,id as Id1 from ' #@__arctype ' where id=". $k)) {

$type _path=gettypeurl ($rowa [' Id1 '],mftypedir ($rowa [' Typedir ']), $rowa [' IsDefault '], $rowa [' DefaultName '], $rowa [' Ispart '], $rowa [' Namerule2 '], $rowa [' SiteURL ']);

$type 2name.= "<a href=". $type _path. "' target=_blank> '. $rowa [' TypeName ']." </a> ";

}

}

}

$this->fields[' Typeid2llink '] =substr ($type 2name,0,strlen ($type 2name)-1);


OK, the content page can show the

For DEDECMS modified also relatively simple, many features may not be as everyone else, we can handle, but if you want to upgrade, your custom function may be gone, we need to pay attention.

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.