名客技术网

简体
繁体
×警告!请输入搜索关键词(仅提示一次)
网站建设电话:15927179345(资深程序)

JEECMS实用的一些经典实战标签(二部分)

作者:网站小编时间:2018-11-28 08:11:57

JEECMS实用的一些经典实战标签(一):

1,网站栏目下拉导航:

 [@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]

2、子栏目页左侧(右侧)调用同级栏目导航:

<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>

3.子栏目页调用当前栏目的顶级类名称:

 ${channel.nodeList[0].name}

4.子栏目页调用当前栏目的父级类名称:

 ${channel.parent.name}

5. 栏目页调用当前栏目内容图:

${channel.contentImg!site.defImg}

6. 子栏目页调用父栏目内容图:

[@cms_channel id=channel.parentId]
<img src="${tag_bean.contentImg!site.defImg}" width="1440" height="231">
[/@cms_channel]

7.栏目页面包屑(位置)导航:

第一种方式:<div class="sitenav"><span>当前位置:首页 [#list channel.nodeList as n] &gt; <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实用的一些经典实战标签(二):

1、父栏目跳转到子栏目

[@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]

2、自定义栏目分页列表样式(添加“WEB-INFtcms_sys_definedstyle_pagechannel_2.html“)

[#--
栏目翻页样式

pageClass: 翻页DIV class
pageStyle: 翻页DIV style
--]
[#assign p=tag_pagination/]
<div class="pagesize">
[#if p.firstPage]&nbsp;<a disabled="disabled">首页</a> <a disabled="disabled">上一页</a>[#t/]
[#else]&nbsp;<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]&nbsp;<a disabled="disabled">下一页</a> <a disabled="disabled">尾页</a>
[#else]&nbsp;<a href="#" onclick="location.href=encodeURI('${hrefFormer}_${p.nextPage}${hrefLatter}');">下一页</a> <a href="#" onclick="location.href=encodeURI('${hrefFormer}_${p.totalPage}${hrefLatter}');">尾页</a>
[/#if]
</div>

3、栏目分页列表实例标签

 <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>


4、栏目分页列表调用附件

[@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]

5、内容页调用附件

<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>

6、后台文章不计数的问题(在内容页加下面代码)

<script type="text/javascript">
$(function() {
Cms.viewCount("${base}","${content.id}");
});
</script>


7、[#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]

8、内容页使用分页的标签

<div class="pagebar">[#include "../style_page/content.html"/]</div>

名客技术网如果无意之中侵犯了您的版权,请联系站长,本站将在3个工作日内删除 QQ:175352796
Copyright 2011-2020 Powered by 121ASK.COM, All Rights Reserved.
备案号:鄂ICP备11013833号-3