在制作DEDE企業模板的時候經常會碰到導航要帶下拉菜單功能的!要使用下拉菜單就必須用到channelartlist標簽,那要怎么才能讓channelartlist標簽當前欄目高亮呢?
熟悉dede的朋友都知道channel標簽的高亮功能dede自帶的。演示代碼:{dede:channel type="top" row="10" currentstyle="
~typename~"}
[field:typename/]說明:當前欄目高亮的樣式是:class="hover"下面我就跟大家分享下channelartlist標簽支持當前欄目高亮方法:
打開include/taglib/channelartlist.lib.php找到$pv->Fields["typeurl"] = GetOneTypeUrlA($typeids[$i]);在此行代碼下方增加以下代碼:// 讓channelartlist支持欄目高亮 Added By dede58
2011/1/19if($typeids[$i]["id"] == $refObj->TypeLink->TypeInfos["id"]){$pv->Fields["currentstyle"] = " class="hover"";}else{$pv->Fields["currentstyle"] = "";}然后在模板文件中調用{dede:field name="currentstyle"/}即可,此字段輸出的內容就是上面$pv->Fields["currentstyle"] = " class="hover""";中的 class="hover""。