program development

dedecms current column highlight and home page highlight method

Yaya has not written a blog for a long time. Recently, I have encountered some problems with my fixed website. I have sorted it out and shared it with all netizens... First of all, let's talk about the general situation of highlighting the homepage […]

article directories

Yaya has not written a blog for a long time. Recently, I have encountered some problems with my fixed website. I have sorted it out and shared it with all netizens...

First of all, let me talkHome Highlight Under normal circumstances, the front page is permanently written. If you write it hard, the homepage style of the homepage will be the same as the column page, which is very unfriendly. The following code determines whether it is a home page. If it is a home page, the style of the home page will add the current attribute to the class.

<li{dede:field name=typeid runphp=”yes”}(@me==””)? @me=” class=’current'”:@me=””;{/dede:field}><a href='{dede:global.cfg_cmsurl/}/’>Home</a></li>

The following code highlights the current column

Open include\taglib\channelartlist.lib.php

  1. $pv->Fields[‘typeurl’] = GetOneTypeUrlA($typeids[$i]); add x below

 

  • 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’] = ”;
  •          }

{dede:channelartlist typeid=’1,6,4,5,7′ row=’10’ currentstyle=’current’}

 

<li class=”{dede:field.currentstyle/}”><a id=”{dede:field name=’id’/}” href=”{dede:field name=’typeurl’/}” >{dede:field name=’typename’/}</a>

<ul class=”list01 aboutpist”>

{dede:channel type=’son’ noself=’yes’}

<li><a href=”[field:typelink/]”>[field:typename/]</a></li>
{/dede:channel}
</ul>
</li>
{/dede:channelartlist}

Add QQ for those who don't understand: 657235615