織夢(mèng)CMS增加欄目推薦功能,讓欄目實(shí)現(xiàn)置頂顯示或者添加一個(gè)樣式風(fēng)格。
  • 效果

  • 教程
1、添加字段 (后臺(tái)-系統(tǒng)-SQL命令行工具-執(zhí)行)
ALTER TABLE `xiuzhanwang_arctype` ADD `ishot` CHAR( 255 ) NOT NULL DEFAULT '';
2、修改/dede/templets/catalog_add.htm
<tr> 
 <td width="150" class='bline' height="26" style="padding-left:10px;">是否隱藏欄目:</td> 
 <td class='bline'> 
 <input type='radio' name='ishidden' value='0' class='np' checked="checked" /> 
 顯示 &nbsp; 
 <input type='radio' name='ishidden' value='1' class='np' /> 
 隱藏 
 </td> 
 </tr> 
在它下面添加
<tr> 
 <td class="bline" style="padding-left:10px;" width="150" height="26">是否推薦欄目:</td> 
 <td class="bline"> 
 <input name="ishot" value="1" class="np" type="radio" /> 
 是 &nbsp; 
 <input name="ishot" value="0" class="np" type="radio" checked='1' /> 
 否 
 </td> 
 </tr> 
3、修改/dede/catalog_add.php
找到(一共有三處)
ishidden,
在它后面增加
ishot,
繼續(xù)找到
'$namerule2','0','0',
修改成
'$namerule2','0','0','0',
4、修改/dede/templets/catalog_edit.htm
找到
<tr>
<td width="150" class='bline' height="26" style="padding-left:10px;">是否隱藏欄目:</td>
  <td class='bline'>
   <input type='radio' name='ishidden' value='0' class='np'<?php if($myrow['ishidden']=="0") echo " checked='1' ";?>/>
   顯示 &nbsp;
   <input type='radio' name='ishidden' value='1' class='np'<?php if($myrow['ishidden']=="1") echo " checked='1' ";?>/>
   隱藏
</td>
</tr>
在它下面增加
<tr>
 <td class="bline" style="padding-left:10px;" width="150" height="26">是否推薦欄目:</td>
 <td class="bline">
  <input name="ishot" value="1" class="np" type="radio" <?php if($myrow['ishot']=="1") echo " checked='1' ";?>>
  是 &nbsp;
  <input name="ishot" value="0" class="np" type="radio" <?php if($myrow['ishot']=="0") echo " checked='1' ";?>/>
  否
 </td>
</tr>
5、修改/dede/catalog_edit.php
找到如下代碼(注意一共有兩處)
ishidden='$ishidden',
在它下面增加
ishot='$ishot',
  • 調(diào)用方法
dede:channel調(diào)用:
{dede:channel row='6' typeid='3' type='son'}
  <li [field:ishot runphp="yes"]
    if(@me==1) @me="class='hot'";else @me="";
    [/field:ishot]>
    <a href="[field:typelink/]">[field:typename/]</a>
  </li>
{/dede:channel}
dede:channelartlist調(diào)用:
<li {dede:field.ishot runphp="yes"}
    if(@me==1) @me="class='hot'";else @me="";
      {/dede:field.ishot}>
     <a href="{dede:field.typeurl/}">{dede:field name='typename'/}</a>
</li>