@JRuiCoder
2015-11-25T12:22:49.000000Z
字数 4928
阅读 2222
HopeCMS
栏目提示、栏目描述有的话就要添加
栏目标识符要特别注意命名规范
内容模型的勾选
一些栏目添加的小技巧
标签的添加,命名 添加一个分类和分类
模板添加一个文件夹,里面可分为首页、栏目页、内容页、单页模板或者功能页模板
路径需要修改
<!DOCTYPE html><html lang="ch"><head>${My_DeChem_HeadFile}<title>${HopeTag.PageTitle}</title>${HopeTag.MetaKeywords}${HopeTag.MetaDescription}</head><body>
{PE.SiteConfig.ApplicationPath/}改为${HopeTag.InstallDir}
{PE.Label id="spmelab_header"/}
HopeCMS的标签引入方式是${标签名} 例如 ${My_DeChem_Header}
{PE.Label id="通用信息列表" bindStyle="表格式common" titleLength="100" outputQty="5" nodes="2551" displayDateTime="yyyy-mm-dd" displayTips="true" /}
HopeCMS采用
<ul class="list">#set($List = ${HopeTag.ArticleListSource(44,true,6)})#if($List.Count > 0)#set($aIndex = 1)#foreach($a in $List)<li class="list_item"><span class="list_time">${HopeTag.FormatDateTime($a.UpdateTime)}</span><div class="list_item_contentBox"><a href="${HopeTag.GetItemLink($a.GeneralID)}">${HopeTag.FormatString("$a.Title",50)}</a></div></li>#set($aIndex= $aIndex + 1)#end#else<li><a>暂无文章!</a></li>#end</ul>
栏目链接:
有三种方式:
通过栏目ID进行获取:${HopeTag.GetCategoryLink(ID)}
相对路径:${HopeTag.InstallDir}+相对路径 例如 ${HopeTag.InstallDir}SchoolIntro/Index.aspx
绝对路径
文章链接
${HopeTag.GetItemLink($Art.GeneralID)}
#set($List = ${HopeTag.ArticlePageSource($CID,false,15)})<!--S page--><div class="hope_pager_web internal_page_web">${HopeTag.InputPager(5)}</div><div class="hope_pager_mobile internal_page_mobile">${HopeTag.InputPager(5)}</div><!--E page-->
$的使用jQuery中使用$表示jQuery,但是HopeCMS标签的调用也有用$符号,容易造成冲突
动易:
<div id="preNext"><ul ><li>{PE.Label id="上一篇" displayDateTime="true" linkOpenType="2" itemId="@RequestInt_Id" nodeArray="{PE.Field id="cone" fieldname="NodeID" /}" /}</li><li>{PE.Label id="下一篇" displayDateTime="true" linkOpenType="2" itemId="@RequestInt_Id" nodeArray="{PE.Field id="cone" fieldname="NodeID" /}" /}</li></ul></div>
HopeCMS:
<div id="preNext"><ul>${HopeTag.PrevNextArticle}</ul></div>
动易的内容页在开头模板都有这么一段代码
{PE.DataSource id="cone" datasource="文章_内容页" itemId="@RequestInt_id" xslt="true" /}
装换的时候不用管,直接删了,这是获取文章来源的。HopeCMS不用这种方式。以下是HopeCMS常用内容页模板比较常用的东西,把它直接放再这里了。
注释版
#set($Art = ${HopeTag.Article}) <!--获取文章来源,并赋值给变量$Art--><h1 class="article_title common_article_title">$Art.Title</h1><!--获取文章标题-->#if(${HopeTag.GetValue("SubTitle")} != "") <!--判断副标题不为空-->#if(${HopeTag.GetValue("SubTitle")} != "Null") <!--判断副标题不为Null--><h2 class="article_title common_article_title" style="font-size:14px">${HopeTag.GetValue("SubTitle")}</h2> <!--获取文章副标题-->#end#end<div class="article_info">作者:#if(${HopeTag.GetValue("Author")} != "")<!--判断作者不为空-->${HopeTag.GetValue("Author")}#else${HopeTag.GetValue("Inputer")} <!--作者为空的话使用录入者的用户名-->#end 来源:#if(${HopeTag.GetValue("CopyFrom")} != "")<!--判断来源不为空-->#if(${HopeTag.GetValue("CopyFrom")} !="Null")<!--判断来源不为Null-->${HopeTag.GetValue("CopyFrom")} <!--获取文章来源-->#end#end 发布时间:${HopeTag.FormatDateTime($Art.InputTime)}<!--获取文章录入时间--> 点击数:${HopeTag.Article.Hits} <!--获取文章点击数--></div><div class="article_body">${HopeTag.GetValue("Content")} <!--获取文章内容--></div><div class="article_editor">文章录入:$Art.Inputer <!--获取文章录入者--> 责任编辑:$Art.Editor<!--获取文章责任编辑--></div>
无注释版
#set($Art = ${HopeTag.Article})<h1 class="article_title common_article_title">$Art.Title</h1>#if(${HopeTag.GetValue("SubTitle")} != "")#if(${HopeTag.GetValue("SubTitle")} != "Null")<h2 class="article_title common_article_title" style="font-size:14px">${HopeTag.GetValue("SubTitle")}</h2>#end#end<div class="article_info">作者:#if(${HopeTag.GetValue("Author")} != "")${HopeTag.GetValue("Author")}#else${HopeTag.GetValue("Inputer")}#end 来源:#if(${HopeTag.GetValue("CopyFrom")} != "")#if(${HopeTag.GetValue("CopyFrom")} !="Null")${HopeTag.GetValue("CopyFrom")}#end#end 发布时间:${HopeTag.FormatDateTime($Art.InputTime)} 点击数:${HopeTag.Article.Hits}</div><div class="article_body">${HopeTag.GetValue("Content")}</div><div class="article_editor">文章录入:$Art.Inputer 责任编辑:$Art.Editor</div>
对于有内容模型的,会有一些相应的字段,这时我们通用的获取的方式就是${HopeTag.GetValue("字段名")},比如我的内容模型里面有一个参考文献的字段名叫ref。则获取的方式就是${HopeTag.GetValue("ref")}。
#set($depth = ${HopeTag.CategoryDepth})#set($RID = ${HopeTag.RootCategoryID})#set($CID = ${HopeTag.CurrentCategoryID})#set($RName = ${HopeTag.GetCategoryName($RID)})#set($CName = ${HopeTag.GetCategoryName($CID)})<div class="main_location"><div class="main_location_locationInfo"><span class="main_location_location-icon"></span>您所在的位置:<a href="${HopeTag.SiteUrl}" title="${HopeTag.SiteName}">${HopeTag.SiteName}</a>#if($depth == 3) >> <a href="${HopeTag.GetCategoryLink($RID)}" title="$RName">$RName</a>#end >> <a href="${HopeTag.GetCategoryLink($CID)}" title="$CName">$CName</a></div></div>
文章栏目链接
${HopeTag.GetItemLink($Art.GeneralID)}
文章的标题
${HopeTag.FormatString("$Art.Title",20)}
获取当前栏目名
${HopeTag.CurrentCategoryName}
获取当前栏目ID
${HopeTag.CurrentCategoryID}
获取默认栏目首页图片或者文章封面图片
${HopeTag.GetSourceDefaultPicUrl($Art)}
1、没有链接时使用双#号,即##,这会被注释掉,后面的内容会消失