Home >CMS Tutorial >DEDECMS >How does Dreamweaver dede make the channelartlist tag support the currentstyle attribute?

How does Dreamweaver dede make the channelartlist tag support the currentstyle attribute?

藏色散人
藏色散人Original
2020-01-09 09:41:212243browse

How does Dreamweaver dede make the channelartlist tag support the currentstyle attribute?

How to make the channelartlist tag support the currentstyle attribute?

DreamWeaver dede allows the channelartlist tag to support the currentstyle attribute

Recommended learning: Dreamweaver cms

Open include\taglib\channelartlist.lib .php

Find

$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);

Add the following code below this line of code:

if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] ){
            $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';
        }
        else{
            $pv->Fields['currentstyle'] = '';
        }

Calling method:

{dede:channelartlist typeid='2' currentstyle='current'}
<li class=&#39;{dede:field.currentstyle/}&#39;><a href=&#39;{dede:field name=&#39;typeurl&#39;/}&#39;>{dede:field name=&#39;typename&#39;/}</a></li>
{/dede:channelartlist}

If it is the current column, then the class of li The attribute displays current, otherwise class='' is displayed. You can also modify currentstyle='change this to the class name you need'.

The above is the detailed content of How does Dreamweaver dede make the channelartlist tag support the currentstyle attribute?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn