JEECMS实用的一些经典实战标签(一):
网站栏目下拉导航:
[@cms_channel_list siteId='1'] <li class="nLi"> <h3><a href="${site.url!}">首页</a></h3> </li> [#list tag_list as c] <li class="nLi"> <h3><a href="${c.url}">${c.name}</a></h3> <ul class="sub"> [@cms_channel_list parentId=c.id] [#list tag_list as cc] <li><a href="${cc.url}">${cc.name}</a></li> [/#list] [/@cms_channel_list] </ul> </li> [/#list] [/@cms_channel_list]
子栏目页左侧(右侧)调用同级栏目导航:
<div class="sadenav"> <ul> [@cms_channel_list parentId= channel.parentId] <li>[#list tag_list as c]<a href="${c.url}" [#if channel??&&channel.id==c.id] class="li_current"[/#if]>${c.name}</a>[/#list]</li> [/@cms_channel_list] </ul> </div>
子栏目页调用当前栏目的顶级类名称:
${channel.nodeList[0].name}
子栏目页调用当前栏目的父级类名称:
${channel.parent.name}
栏目页调用当前栏目内容图:
${channel.contentImg!site.defImg}
子栏目页调用父栏目内容图:
[@cms_channel id=channel.parentId] <img src="${tag_bean.contentImg!site.defImg}" width="1440" height="231"> [/@cms_channel]
栏目页面包屑(位置)导航:
第一种方式: <div class="sitenav"><span>当前位置:首页 [#list channel.nodeList as n] > <a href="${n.url}">${n.name}</a>[/#list]</span>${channel.name}</div> 第二种方式: <div>当前位置:首页 > <a href="${channel.nodeList[0].url}">${channel.nodeList[0].name}</a> > <a href="${channel.nodeList[1].url}"><strong>${channel.nodeList[1].name}</strong></a> </div>
JEECMS实用的一些经典实战标签(二):
父栏目跳转到子栏目[@cms_channel_list parentId=channel.id count='1'] [#list tag_list as c] <script type="text/javascript"> window.location.href="${c.url}"; </script> [/#list] [/@cms_channel_list]
[#-- 栏目翻页样式 pageClass: 翻页DIV class pageStyle: 翻页DIV style --] [#assign p=tag_pagination/] <div class="pagesize"> [#if p.firstPage] <a disabled="disabled">首页</a> <a disabled="disabled">上一页</a>[#t/] [#else] <a href="#" onclick="location.href=encodeURI('${hrefFormer}${hrefLatter}');">首页</a> <a href="#" onclick="location.href=encodeURI('${hrefFormer}[#if p.prePage gt 1]_${p.prePage}[/#if]${hrefLatter}');">上一页</a>[#t/] [/#if] [#list 1..p.totalPage as i] <a href="#" onclick="location.href=encodeURI('${hrefFormer}_${i}${hrefLatter}');"[#if p.pageNo==i] class="page_current"[/#if]>${i}</a> [/#list] [#if p.lastPage] <a disabled="disabled">下一页</a> <a disabled="disabled">尾页</a> [#else] <a href="#" onclick="location.href=encodeURI('${hrefFormer}_${p.nextPage}${hrefLatter}');">下一页</a> <a href="#" onclick="location.href=encodeURI('${hrefFormer}_${p.totalPage}${hrefLatter}');">尾页</a> [/#if] </div>
栏目分页列表实例标签
<div class="news_cont"> [@cms_content_list channelId=channel.id count='1' Recommend='1' titLen='30' descLen='80' append='...' orderBy='2' dateFormat='yyyy-MM-dd'] [#list tag_list as a] <dl> <dt><a href="${a.url}"><img src="${a.typeImg!site.defImg}" width="149" height="110"></a></dt> <dd> <h3><span>${a.date?string(dateFormat)}</span><a href="${a.url}">[@text_cut s=a.title len=titLen append=append /]</a></h3> <p>[@text_cut s=a.desc len=descLen append=append/]</p> <p><a href="${a.url}">[+查看详细]</a></p> </dd> </dl> [/#list] [/@cms_content_list] [@cms_content_page channelId=channel.id count='12' sysPage='2' titLen='40' append='...' orderBy='2' dateFormat='yyyy-MM-dd' channelOption='1'] <ul class="news_ul"> [#list tag_pagination.list as a] <li><span>${a.date?string(dateFormat)}</span><a href="${a.url}">[@text_cut s=a.title len=titLen append=append /]</a></li> [/#list] </ul> [/@cms_content_page] </div>
栏目分页列表调用附件
[@cms_content_page channelId=channel.id count='12' sysPage='2' titLen='40' append='...' orderBy='2' dateFormat='yyyy-MM-dd' channelOption='1'] <ul class="download_ul"> [#list tag_pagination.list as a] [#if a.attachments?size == 1] [#list a.attachments as attach] <li> <a href="${attach.path}" title="${attach.name}">[点击下载]</a>[@text_cut s=a.title len=titLen append=append /]</li> [/#list] [/#if] [/#list] </ul> [/@cms_content_page]
内容页调用附件
<script type="text/javascript"> $(function() { Cms.attachment("${base}","${content.id}","${content.attachments?size}","attach"); }); </script> <div class="show_cont_info"> [#if content.attachments?size gt 0] [#list content.attachments as attach] <p><a id="attach${attach_index}">附件文档:${attach.name!}</a></p> [/#list] [/#if] </div>
后台文章不计数的问题(在内容页加下面代码)
<script type="text/javascript"> $(function() { Cms.viewCount("${base}","${content.id}"); }); </script>
后台 [#if] [#else] [/#if] 的使用
[#list tag_pagination.list as a] <ul class="news_ul"> [#if "${a_index+1}"="1"] <li class="xxxx"> <span>${a.date?string(dateFormat)}</span><a href="${a.url}" target="_blank">[@text_cut s=a.title len=titLen append=append/]</a> </li> [#else] <li> <span>${a.date?string(dateFormat)}</span><a href="${a.url}" target="_blank">[@text_cut s=a.title len=titLen append=append/]</a> </li> [/#if] </ul> [/#list]
内容页使用分页的标签
<div class="pagebar">[#include "../style_page/content.html"/]</div>