Zhimeng cms calls tag Keyword implementation method

Source: Internet
Author: User

GetAll = 0 Call Current page tag
GetAll = 1 Call the tag tag of the whole station

Example

Current article

The code is as follows Copy Code

{dede:tag sort= ' new ' getall= ' 0′}<a href= ' [field:link/] ' >[field:tag/]</a>{/dede:tag}

Call Full Station

The code is as follows Copy Code

{dede:tag sort= ' new ' getall= ' ′}<a href= ' [field:link/] ' >[field:tag/]</a>{/dede:tag}


If I want to have a label to come out tags tags: a,b,c So, this dedecms is not an example, the following see I modify the method.


Locate the channelunit.func.php file in the Include directory, plus

The code is as follows Copy Code

function Getarttag ($id)
{
$tags = ';
$id = Intval ($id);
$dsql = new Dedesql (false);
$sql = "SELECT ' Tag ' from #@__taglist where aid= ' $id '";
$dsql->setquery ($sql);
$dsql->execute (' HW ');
while ($row = $dsql->getarray (' HW '))
{
if ($tags = = "")
{
$tags = ' tag tag: <a href= '/tags/'. UrlEncode ($row [' tag ']). ' /">". $row [' tag ']. ' </a> ';
}
Else
{
$tags. = ', <a href= '/tags/'. UrlEncode ($row [' tag ']). ' /">". $row [' tag ']. ' </a> ';
}
}
return $tags;
}

And then find your site template file on the page plus

The code is as follows Copy Code

{Dede:field.aid function= "Getarttag (@me)"/}

So that makes the call OH. Original site reprinted annotated source http://www.111cn.net otherwise must investigate

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.