dedecms导航,当前栏目高亮显示代码

来源:互联网 发布:oracle连接mysql详解 编辑:程序博客网 时间:2024/05/16 06:05
classfunctionhtml
[html] view plaincopy
  1. <li{dede:field name=typeid runphp="yes"}(@me=="")? @me=" class='hover'":@me="";{/dede:field}><a href='{dede:global.cfg_cmsurl/}/'><span>主页</span></a></li>  
  2. {dede:channel type='top' row='10' currentstyle="<li class='hover'><a href='~typelink~' ~rel~><span>~typename~</span></a></li>"}  
  3. <li><a href='[field:typeurl/]' [field:rel/]><span>[field:typename/]</span></a></li>  
  4. {/dede:channel}  

获取typeid,三元运算,(@me=='')?要真入当前id .或其他作于判断的条件,

[html] view plaincopy
  1. {dede:arclist row=4 orderby=pubdate type='image.' }  
  2.                                     <li class="normal" onmouseover="picChange([field:global name='autoindex' /])">  
  3.                                         <img src="[field:litpic/]" alt="[field:title function='html2text(@me)'/]  
  4.                                     </li>  
  5.                                 {/dede:arclist}  
[html] view plaincopy
  1. {dede:global name='itemindex'/}  
  2.   
  3. {dede:channelartlist typeid='top'}  
  4.    <span>索引:{dede:global name='itemindex'/}</span>  
  5.    <a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>  
  6.    {dede:arclist titlelen='1024' row=7}  
  7.    <a href="[field:arcurl /]" title="[field:title /]">[field:title /]</a>  
  8.    {/dede:arclist}  
  9. {/dede:channelartlist}  
  10.    
  11. // arclist 和 list 中可以使用这个:  
  12. {arclist typeid='14' titelen='1024'}  
  13.    [field:global name='autoindex' /]  
  14.    [field:title/]  
  15.    [field:arcurl/]  
  16. {/dede:arclist}  
[html] view plaincopy
  1.   
[html] view plaincopy
  1.  [field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global] 减1  

autoindex输出索引
[html] view plaincopy
  1. [field:pubdate function="MyDate('m-d ',@me)"/]  
[html] view plaincopy
  1.   

时间

[html] view plaincopy
  1. [field:array runphp='yes']@me = (strpos(@me['litpic'],'defaultpic') ? "" : "<a href='{@me['arcurl']}' class='preview'><img src='{@me['litpic']}'/></a>"); [/field:array]  
  2.                                   
没有图片显示文字
[html] view plaincopy
  1. {dede:channelartlist typeid='3,5'}  
  2. <a href="{dede:field name='typeurl'/}"><b>{dede:field name='typename'/}</b></a>(上一级栏目)<br>  
  3. {dede:channel type='son' noself='yes'}  
  4. <a href="[field:typelink/]">[field:typename/]</a><br />  
  5. {/dede:channel}  
  6. <hr><!-- 这里我们加一个横线,区分2个不同栏目的调用效果 -->  
  7. {/dede:channelartlist}  

[html] view plaincopy
  1. {dede:channelartlist}                                  
  2.             [field:global name=autoindex runphp="yes"](@me%2==0)? @me="<div class=global_module box_r>":@me="<div class=global_module>";[/field:global]  
  3.             {dede:arclist titlelen=’40′ row=’11′}      
  4.            <a href="[field:arcurl /]" title="[field:title/]" target="_blank">[field:title /]</a>      
  5.             {/dede:arclist}  
  6.         </div>  
  7.       {/dede:channelartlist}  


循环生产列表,判断第二个就 加个样式<div class=global_module box_r>,否则就<div class=global_module>

貌似 不行,直接输出到页面显示的是
[field:global name=autoindex runphp="yes"](@me%2==0)? @me="":@me="";[/field:global] 

解决方法

[field:global name=autoindex runphp='yes']@me=$GLOBALS['autoindex']%2==0?’<div class="global_module box_r">’:'<div class="global_module">’;[/field:autoindex]

0 0