IT教程 | 加入收藏 | 简体 | 繁体
JavaCMS:科汛CMSPhpCMS织梦CMSShopCMS论坛CMSJavaCMS
当前位置: 首页 > CMS教程 > JavaCMS

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

2015-01-10来源:[www.121ask.com]热度:0℃ 【字体:

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-INF\t\cms_sys_defined\style_page\channel_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>

以上IT文章《JEECMS实用的一些经典实战标签(二)》由名客技术网[www.121ask.com]提供阅读!
名客技术网是一个免费为广大IT技术人员提供IT教程,绿色软件,asp/php/jsp/java/net等实例视频教程,CMS教程,破解软件下载以及学习相关源码、知识的IT网站。
名客技术网如果无意之中侵犯了您的版权,请来电告知,本站将在3个工作日内删除 QQ:175352796
Copyright 2011-2017 Powered by 121ASK.COM, All Rights Reserved.
备案号:鄂ICP备11013833号-3