<#--用法:<@zrar.isFamilyMacro catId ,topId> htmlCode </@zrar.isFamilyMacro> -->
<#--用法解析:当 isFamilyMacro 返回值为true 时 输出 标签中间的htmlCode 返回false 不会输出htmlcode--> <#macro isFamilyMacro catId='' <#--子栏目ID 必填 --> topId='' <#--顶级栏目 id 必填 --> > <#local f = spring.categoryServiceImpl.ftlIsFamily(catId,topId)> <#if f> <#nested true><#t> </#if> </#macro> <#include 'common.ftl'>
<#include 'uicomponent.ftl'> <#include 'cat_frame.ftl'> <#include 'search_frame.ftl'> <#include 'link.ftl'> <#include 'associationdoc.ftl'> <#include 'secondcattree.ftl'> <#include 'counciluser.ftl'> <#include 'index_counciluser.ftl'> <#include 'associators.ftl'> <#include 'productshow.ftl'> <#include 'hyzs_area.ftl'> <#-- 文章列表 --> <#macro contentList> <#local listss=spring.contentServiceImpl.findAll()> <#list listss as e> <#nested e, iteratorStatus(e_index, listss?size)> </#list> </#macro> <#macro catDoc docIds=[] <#--文档Id。列出指定文档['888', '889', '901']的文档--> flag='' <#--内容自定义属性:原/转,新、推荐、精、热、图,1表示启用,0表示禁用110011(或者的关系表示 原、新、热、图,只要有其中一个就查出来)--> catIds=[] <#--栏目Ids--> modelTypes=[] <#--模型type。例如:列出["article", "soft"]下的模型的所有文档。--> beginTime='' <#--指定发布的开始时间 yyyy-mm-dd--> endTime='' <#--指定发布的结束时间 yyyy-mm-dd--> keywords=[] <#--内容的关键字 或者的关系。['黄金', '股票']--> condition='' <#--自定义查询条件 obj.isTop=1 --> orderBy='' <#--排序方式 默认排序 置顶 、 发布时间倒序--> limit=[] <#--行数 [0, 10]或[10]都是从列出前10条数据--> pagination=false <#--分页取消 后台分页 这里 可以实现 与limit 相同的效果 与limit同时使用时 limit 优先 --> pageSize=10 <#--如果启用分页 每页记录数 默认 每页10条--> crrunetPage=1 showLike=false random=false maxPageCount=1000 > <#local listss=spring.contentServiceImpl.ftlFindAll(docIds, flag, catIds,modelTypes, beginTime, endTime,keywords, condition, orderBy, limit, pagination, pageSize, crrunetPage showLike, random, maxPageCount)> <#list listss as e> <#nested e, iteratorStatus(e_index, listss?size)><#t> </#list> </#macro> <#macro topicDoc <#--参数同上 catDoc 参数说明--> docIds=[] flag='' topicId='' <#--专题ID--> contentTypes=[] begintime='' endTime='' condition='' orderBy='' limit=[] pagination=false pageSize=100 crrunetPage=1 showLike=false rondom=false maxPageCount=1000 > <#local listss=spring.contentServiceImpl.ftlFindAllTopic( docIds,flag,topicId,contentTypes, begintime,endTime,condition,orderBy,limit, pagination, pageSize, crrunetPage, showLike,rondom,maxPageCount)> <#list listss as e> <#nested e, iteratorStatus(e_index, listss?size)><#t> </#list> </#macro> <#-- 顶级栏目列表 参数是或者的关系 -->
<#macro topCat catIds=[] <#--指定的顶级栏目列表--><#--两个参数可同时存在,获取 站点 下的栏目 以及指定的栏目 --> siteIds=[] <#--指定的站点下的顶级栏目列表--> > <#local cs = spring.categoryServiceImpl.ftlFindCat(catIds,siteIds)> <#list cs as e> <#nested e, iteratorStatus(e_index, cs?size)><#t> </#list> </#macro> <#-- 子栏目(全部显示 不收缩) --> <#macro sonCat catId='' <#--父栏目ID--> step='' <#--层级分隔符--> > <#local cs = spring.categoryServiceImpl.ftlFindSonCat(catId)> <#list cs as e> ${step}${(e.catName)!''}<br/> <#nested e, iteratorStatus(e_index, cs?size)><#t> <@sonCat catId=e.categoryId step=step+step/> </#list> </#macro> <#-- 栏目树形(全部显示 不收缩) catIds siteIds是或者的关系--> <#macro catTree catIds=[] <#--栏目IDs 获取该集合的栏目树形 --> siteIds=[] <#--站点集合下的栏目树型--> step='' <#--栏目层级关系分隔符--> > <#local cs = spring.categoryServiceImpl.ftlFindCat(catIds,siteIds)> <#list cs as e> ${step}${(e.catName)!''}<br/> <@sonCat catId=e.categoryId step=step/> </#list> </#macro> <#--分页标签 只能用于栏目目 专题 等内容列表的生成 (只有此时的生成提供标签所需的参数)-->
<#macro pagination currentPage=1 <#--当前页 默认 1--> totalPage=0 <#--总页数--> baseUrl='' <#--基本的列表分页链接 例如:真实列表页第一页链接http://www./cat/cat1/list.html baseurl 后台传参‘http://www./cat/cat1/list’ 标签来处理文件后缀‘.html’。 若列表页只有一页,不展示分页。超过一页才展示分页,第一页内容列表文件名"list.html",第二页"list_2.html", 第三页"list_3.html",其他页一次类推--> currentClass='' <#--当前页css 区别于其他链接--> otherClass='' <#--当前页外的其他链接css--> > <#if totalPage > 1> <#if currentPage == 1 || currentPage == 2> <a class="" href="${baseUrl}.html">上一页</a> <#else> <a class="" href="${baseUrl}_${currentPage-1}.html">上一页</a> </#if> <#list 1..totalPage as i> <a class="<#t> <#if currentPage?? && currentPage == i> ${currentClass}<#t> <#else> ${otherClass}<#t> </#if> " href="${baseUrl}<#t> <#if i > 1><#t> _${i}<#t> </#if><#t> <#t>.html" >${i} </a> </#list> <#if currentPage == totalPage> <a class="" href="${baseUrl}_${totalPage}.html">下一页</a> <#else> <a class="" href="${baseUrl}_${currentPage+1}.html">下一页</a> </#if> </#if> </#macro> <#--专题列表-->
<#macro topicList siteIds=[] <#--站点ids 站点 专题可同时存在 或者的关系 --> topicIds=[] <#--专题ids--> limit=[] <#--获取结果数量--><#--行数 [0, 10]或[10]都是从列出前10条数据--> > <#local ts = spring.topicServiceImpl.ftlFindTopics(siteIds,topicIds,limit)> <#list ts as e> <#nested e, iteratorStatus(e_index, ts?size)><#t> </#list> </#macro> <#--面包屑--> <#macro crumbs catId='' <#--栏目ID 必填 否则 抛出异常--> type='' <#--index list 二选一 必填 否则 抛出异常--> > <div class="crumb"> 您现在的位置: <#local cat = spring.categoryServiceImpl.ftlFindCatById(catId)> <#if cat?? && (cat.category.categoryId)??> <@catStep catId=cat.category.categoryId type=type/> </#if> <#t> ${(cat.catName)!''}<#t> </div><#t> </#macro> <#--面包屑 暂时仅适用用于个私协会协会理事的 面包屑-->
<#macro specialcrumbs catId='' <#--栏目ID 必填 否则 抛出异常--> objectName='' <#--协会名称的名称 --> > <div class="crumb"> 您现在的位置: <#local cat = spring.categoryServiceImpl.ftlFindCatById(catId)> <#if cat?? && (cat.category.categoryId)??> <@catStep catId=cat.category.categoryId type='index'/> </#if> <#t> <@catUrl catId=catId/><#t> >${objectName} </div><#t> </#macro> <#--栏目 根据ID 查栏目-->
<#macro catStep catId='' <#--栏目ID 必填 否则 抛出异常--> type='' <#--index list 二选一 必填 否则 抛出异常--> > <#local c = spring.categoryServiceImpl.ftlFindCatById(catId)> <#if c?? && (c.category.categoryId)??> <#local f = spring.categoryServiceImpl.ftlFindCatById(c.category.categoryId)> <#if f?? && (f.category.categoryId)??> <@catStep catId=f.category.categoryId type=type /> </#if><#t> <@catUrl catId=f.categoryId type=type /><span>></span><#t> </#if> <#t> <@catUrl catId=c.categoryId type=type /><span>></span><#t> </#macro> <#--栏目的URL路径获取,输出: <a href="">catname</a>-->
<#macro catUrl catId='' <#--栏目ID 必填 否则 抛出异常--> type='index' <#--index list 二选一 必填 否则 抛出异常--> text='' <#--a标签的text内容 有参数 <a>text</a> 无参数<a>catname</a>--> class='' <#--公告主键--> > <#local catUrl = spring.categoryServiceImpl.ftlCatCrumbs(catId,type,text,class)> ${(catUrl)!''} </#macro> <#--页面左侧树--> <#macro leftTree catId='' <#--栏目ID 必填 否则 抛出异常--> hiddenIds=[] <#--字符串数组 不在树中显示 这些栏目的子栏目--> > <#local trees =spring.categoryServiceImpl.ftlFindSonsByTopCatId(catId,hiddenIds)> <div class="menutree fl"> <@leftTreeInit cats=trees /> </div> </#macro> <#macro leftTreeInit cats=[] index=0 > <#if cats?size > 0 > <ul> <#list cats as c> <li> <div><@catUrl catId=c.categoryId type='index' /> </div> <@leftTreeInit cats=c.sons index=index+1/> </li> </#list> </ul> </#if> </#macro> <#-- (本标签暂时作废 : 左侧树请调用leftTree) 页面左侧树 只展开 所传参数的父祖辈栏目(顶级栏目下)--> <#macro cancelleftTree catId='' <#--栏目ID 必填 否则 抛出异常--> > <#local list =spring.categoryServiceImpl.ftlFindFamilyLine(catId)> <div class="menutree fl"> <ul> <@cancelleftTreeInit ids=list /> </ul> </div> </#macro> <#macro cancelleftTreeInit ids=[] spt='--' index=0 > <#local cats =spring.categoryServiceImpl.ftlFindSonCat(ids[index])> <#list cats as cat> <#if index==0><h3>${(cat.catName)!''}</h3> <#elseif index==1><span>${(cat.catName)!''}</span> <#elseif index==2><a>${(cat.catName)!''}</a> <#else>${(cat.catName)!''} </#if> <#list ids as cId> <#if cId == cat.categoryId> <@leftTreeInit ids=ids spt=spt+'--' index=index+1/> </#if> </#list> </#list> </#macro> <#--获取某一栏目 以及此栏目的count个子栏目-->
<#function catInfo catId='' count=0 > <#local cats =spring.categoryServiceImpl.ftlFindCatInitUsableSons(catId,count)> <#return cats> </#function> <#--获取文章图片上传路径-->
<#macro contentImg contentId='' <#--文章ID--> <#--个数--> > <#local ct = spring.contentAttachServiceImpl.ftlFindContentImg(contentId)> <#list ct as c> <#nested c, iteratorStatus(c_index, ts?size)><#t> </#list> </#macro> <#macro enterprise
code='' <#--行业类型编码 '126','127','128',如果为空表示所有类型--> level=1 <#--行业类型等级,默认为1--> max=3 <#--获取最大记录数,默认为3--> szcode=100000 <#--推荐的区域协会,默认是全国个协--> > <#local listss = spring.enterpriseServiceImpl.ftlFindByTypeCode(code,level,max,szcode)> <#list listss as e> <#nested e, iteratorStatus(e_index, listss?size)><#t> </#list> </#macro> <#--内容的URL路径获取,输出: <a href=".../id.html">title</a>-->
<#macro contentUrl contentId='' <#--内容ID 必填 --> text='' <#--a标签的text内容 有参数 <a>text</a> 无参数<a>title</a>--> class='' <#--css class--> length=0 <#--文字长度,默认为0,不截取,如果text不为空,此项无效--> > <#local content = spring.contentServiceImpl.getContent(contentId)> <#if text==""> <a href="${site.siteDomain?default('')}/${content.publishUrl?default('')}"<#if class!=""> class='${class}'</#if>><#if length==0>${content.contentTitle?default('')}<#else>${content.cutTitle(length)}</#if></a> <#else> <a href="${site.siteDomain?default('')}/${content.publishUrl?default('')}"<#if class!=""> class='${class}'</#if>>${text}</a> </#if> </#macro> <#function isFamily
catId='' <#--子栏目ID 必填 --> topId='' <#--顶级栏目 id 必填 --> > <#local f = spring.categoryServiceImpl.ftlIsFamily(catId,topId)> <#return f > </#function> <#--用法:<@zrar.isFamilyMacro catId ,topId> htmlCode </@zrar.isFamilyMacro> -->
<#--用法解析:当 isFamilyMacro 返回值为true 时 输出 标签中间的htmlCode 返回false 不会输出htmlcode--> <#macro isFamilyMacro catId='' <#--子栏目ID 必填 --> topId='' <#--顶级栏目 id 必填 --> > <#local f = spring.categoryServiceImpl.ftlIsFamily(catId,topId)> <#if f> <#nested true><#t> </#if> </#macro> |
|
来自: 闪宁斯达 > 《freemarker》