TRS_WCM置标过程中经验积累
版本V4.0-2014.6.24-穿越者7号
目录
4、取既定栏目下第一篇文章的标题,截取正文部分,以及第一个附件图片的输出 2
例如:<trs_template tempname="header" />定义首页头部的实例。
例如:<TRS_CHANNEL ID='公司新闻' FIELD='_RECURL'/>
例如:<div class="new_list">
<TRS_DOCUMENTS id="公司新闻" channeltype="0" num="8" startpos="0" automore="FALSE" moretarget="_blank" moretext="更多..." enablelimit="FALSE">
<ul class="list_ul">
<li><TRS_DOCUMENT field="DOCTITLE" num="56" dateformat="yyyy-MM-dd HH:mm:ss" target="_blank"/></TRS_DOCUMENT>
<span><TRS_DATETIME DATEFORMAT="yyyy-MM-dd">发布日期</TRS_DATETIME></span></li>
</ul>
</TRS_DOCUMENTS>
例如:<TRS_DOCUMENTS ID="主要产品" NUM="1" STARTPOS="0">
<TRS_APPENDIX MODE="PIC" INDEX="0" WIDTH="150" HEIGHT="120" EXTRA="style='border:0'" AUTOLINK="true" TARGET="_blank">picture</TRS_APPENDIX>
<h1><a href="<TRS_DOCUMENT FIELD='_RECURL'/>" class="red_h_18" TARGET="_blank"><TRS_DOCUMENT FIELD="DOCTITLE" AUTOFORMAT="false" AUTOCOLOR="false" AUTOLINK="false">title</TRS_DOCUMENT></a></h1>
<a href="<TRS_DOCUMENT FIELD='_RECURL'/>" TARGET="_blank">
<TRS_COLUMN id=DOCHTMLCON NUM="116"></TRS_COLUMN></a>
</TRS_DOCUMENTS>
例如:<TRS_DOCUMENTS id="友情链接" channeltype="0" num="5" startpos="0" automore="FALSE" moretarget="_blank" moretext="更多..." enablelimit="FALSE">
<script language="JavaScript" type="text/javascript">
var urltitle='<TRS_DOCUMENT FIELD="DOCTITLE" TARGET="_blank">文档标题</TRS_DOCUMENT>';
var urladdress='<TRS_DOCUMENT FIELD="DOCSOURCE" TARGET="_blank">文档来源</TRS_DOCUMENT>';
document.write('<a href="'+urladdress+'">'+urltitle+'</a>');
</script>
</TRS_DOCUMENTS>
例如:<TRS_CHANNEL ID="OWNER">本栏目名称</TRS_CHANNEL>
例如:<TRS_COLUMN id=_TRSCURPAGE>当前位置</TRS_COLUMN>
例如:
<SCRIPT LANGUAGE="JavaScript">
<!--
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
if(_nPageCount == null || _nPageCount<=1){
return;
}
var nCurrIndex = _nCurrIndex || 0;
document.write("第");
if(nCurrIndex == 0)
document.write(" 1 ");
else
document.write(" <a href=\""+_sPageName+"."+_sPageExt+"\" >1</a> ");
for(var i=1; i<_nPageCount; i++){
if(nCurrIndex == i)
document.write((i+1) + " ");
else
document.write("<a href=\""+_sPageName+"_" + i + "."+_sPageExt+"\" >"+(i+1)+"</a> ");
}
document.write("页");
}
-->
</SCRIPT>
<TRS_DOCUMENTS pagesize="12" id="owner" channeltype="0" num="120" startpos="0" automore="FALSE" moretarget="_blank" moretext="更多..." enablelimit="FALSE"></TRS_DOCUMENTS>
<SCRIPT type="text/javascript">
createPageHTML( ${PAGE_COUNT}, ${PAGE_INDEX}, "${PAGE_NAME}", "${PAGE_EXT}");
</SCRIPT>
例如:<TRS_PAGEGENERATE TEMPNAME="另一个模板名称" OnlyPublish ="false" AUTOUPDATE="true"/>
例如:
<script language="JavaScript" type="text/javascript">
Var contactway="<TRS_DOCUMENT FIELD="SUBDOCTITLE" AUTOFORMAT="TRUE">副标题</TRS_DOCUMENT>".split('||');
</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[0]);</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[1]);</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[2]);</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[3]);</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[4]);</script>
<script language="JavaScript" type="text/javascript">document.write(contactway[5]);</script>
例如:<TRS_COLUMN id=DOCHTMLCON>
HTML文本
</TRS_COLUMN>
例如:<TRS_PHOTO index='1' width='100'/>
<TRS_PHOTO index='2' width='100'/>
例如:<TRS_DOCUMENT FIELD=DOCTITLE autocolor="false">标题</TRS_DOCUMENT>
<TRS_DOCUMENT FIELD="DOCSOURCE">文档来源</TRS_DOCUMENT>
<TRS_COLUMN id=DOCPUBTIME>发布时间</TRS_COLUMN>
<TRS_APPENDIX INDEX="0" MODE="PIC" WIDTH="500">图片附件1</TRS_APPENDIX>
<TRS_APPENDIX INDEX="0" MODE="PIC" FIELD="APPDESC" NAMEONLY="true"/>
例如:
<script>
function g(o){return document.getElementById(o);}
function Hover(n){
switch(n)
{
case 1:
g('gsxw').className='gsxw';
g('jtxw').className='jtxw_link';
g('gsxw_1').className='show';
g('jtxw_1').className='hide';
g('gsxw_2').href='<TRS_CHANNEL ID='公司新闻' FIELD='_RECURL'/>';
break;
case 2:
g('gsxw').className='gsxw_link';
g('jtxw').className='jtxw';
g('gsxw_1').className='hide';
g('jtxw_1').className='show';
g('gsxw_2').href='<TRS_CHANNEL ID='集团新闻' FIELD='_RECURL'/>';
break;
case 3:
g('whdt').className='whdt';
g('zhzx').className='zhzx_link';
g('whdt_1').className='show';
g('zhzx_1').className='hide';
g('whdt_2').href='<TRS_CHANNEL ID='文化动态' FIELD='_RECURL'/>';
break;
case 4:
g('whdt').className='whdt_link';
g('zhzx').className='zhzx';
g('whdt_1').className='hide';
g('zhzx_1').className='show';
g('whdt_2').href='<TRS_CHANNEL ID='综合资讯' FIELD='_RECURL'/>';
break;
case 5:
g('cpfw').className='cpfw';
g('kjcx').className='kjcx_link';
g('cpfw_1').className='show';
g('kjcx_1').className='hide';
g('kjcx_2').href='<TRS_CHANNEL ID='产品与服务' FIELD='_RECURL'/>';
break;
case 6:
g('cpfw').className='cpfw_link';
g('kjcx').className='kjcx';
g('cpfw_1').className='hide';
g('kjcx_1').className='show';
g('kjcx_2').href='<TRS_CHANNEL ID='科技创新' FIELD='_RECURL'/>';
break;
case 7:
g('shzr').className='shzr';
g('rczp').className='rczp_link';
g('shzr_1').className='show';
g('rczp_1').className='hide';
g('shzr_2').href='<TRS_CHANNEL ID='社会责任' FIELD='_RECURL'/>';
break;
case 8:
g('shzr').className='shzr_link';
g('rczp').className='rczp';
g('shzr_1').className='hide';
g('rczp_1').className='show';
g('shzr_2').href='http://10.2.20.11:9080/hxks/outline_zw.jsp?job_type=2" class="more';
break;
default:
alert("你好");
}
}
</script>
<a href="###" class="gsxw" id="gsxw" onclick="Hover(1);" >公司新闻</a>
<a href="###" class="jtxw_link" id="jtxw" onclick="Hover(2);">集团新闻</a>
<A href="<TRS_CHANNEL ID='公司新闻' FIELD='_RECURL'/>" id="gsxw_2" class="more"> 更多>></A>
例如:
<!--幻灯片新闻开始-->
<script language="JavaScript" type="text/javascript">
var focus_width=250 /*幻灯片新闻图片宽度*/
var focus_height=180 /*幻灯片新闻图片高度*/
var text_height=20 /*幻灯片新闻文字标题高度*/
var swf_height = focus_height+text_height
var pics = '';
var links = '';
var texts = '';
var text_s = '';
function ati(url, img, title, titls)
{
if(pics != '')
{
pics = pics + "|";
links = links + "|";
texts = texts + "|";
text_s = text_s + "|";
}
pics = pics + escape(img);
links = links + escape(url);
texts = texts + encodeURIComponent(title)
text_s = text_s + encodeURIComponent(titls)
}
</script>
<script language=javascript>
<trs_documents id="公司新闻" num="5" where="attachpic>0">
ati('<trs_document field="_recurl" />', '<trs_contimg field="url" />', '<trs_document field="doctitle" autolink="false" num="39" />');
</trs_documents>
document.write('<embed src="10004207_999645.swf" wmode="transparent" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" OLDSRC="10004207_999645.swf" OLDID="494" RELATED="1" />');
</script>
<!--幻灯片新闻结束-->
如代码中红色字体部分要引入一个Flash播放器文件,下载地址:http://pan.baidu.com/s/1kTgOrwN
<trs_documents id="五矿新闻" num="1" where="attachpic>0">
<div class="img_fck"><img src='<trs_contimg field="url" />' width="192" height="124" /></div>
<div class="cont_fck">
<h1><font color="#3300FF"><trs_document field="doctitle" target="_blank" /></font></h1>
<h2><a href="<trs_document field='url' />"><trs_document field="DOCCONTENT" num="100" /></a></h2>
</div>
</trs_documents>
<TRS_APPENDIX MODE="PIC" UrlIsAbs="true" FIELD="_RECURL" INDEX="0" WIDTH="150" HEIGHT="120" EXTRA="style='border:0'" AUTOLINK="true" TARGET="_blank">picture</TRS_APPENDIX>
<TRS_XAPPENDIXS ID="OWNER" MODE="FILE">
<font>附件1下载:</font> <a href='<TRS_XAPPENDIX FIELD="_RECURL" upload="true"/>' target="_blank" style="text-decoration:none;">
<TRS_DOCUMENT FIELD=DOCTITLE autocolor="false">标题</TRS_DOCUMENT></a><br/>
</TRS_XAPPENDIXS>
<trs_document field="DOCAUTHOR" />
<trs_document field="docreltime" dateformat="yyyy-MM-dd" autolink="false" />
<TRS_XAPPENDIXS ID="OWNER" MODE="PIC">
<img src='<TRS_XAPPENDIX FIELD="_RECURL" upload="true"/>' border=0 onload="if(this.width>550) this.width=550" /><br><br><br><br>
</TRS_XAPPENDIXS>
Order="channelId Desc" Order="docreltime Desc" 备注:在<trs_documents/>上添加属性
LINKALT="true"
<a href="<TRS_APPENDIX INDEX="0" MODE="PIC" FIELD="_RECURL" />" target="_blank"><TRS_APPENDIX INDEX="0" MODE="PIC" WIDTH="117">图片附件1</TRS_APPENDIX></a>
26、判断标签(应用场景:多级导航)
<div class="glleft"> <div class=""><img src="dotted.jpg" align="absmiddle" OLDSRC="dotted.jpg" OLDID="3260" RELATED="1" /></div> <div class="gsxw"><a href="<trs_channel id="owner" field=_recurl autolink=false/>" class="BlueLink"><trs_channel id="parent" autolink=false/></a></div> <div><img src="hx1.jpg" align="absmiddle" OLDSRC="hx1.jpg" OLDID="3261" RELATED="1" /></div> <!--==================end 左栏==================--> <TRS_CONDITION REFERENCE="主营业务" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="主营业务" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="友情链接" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="友情链接" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="新闻动态" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="新闻动态" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="公司概况" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="公司概况" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="管理团队" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="管理团队" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="内部管理" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="内部管理" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="政策法规" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="政策法规" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="企业文化" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="企业文化" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> <TRS_CONDITION REFERENCE="联系我们" CONDITION="@PARENT.chnlname" OPERATOR="contain"> <trs_channels id="联系我们" startpos="0"> <div class="lm"><img src="arrow5.jpg" align="absmiddle" OLDSRC="arrow5.jpg" OLDID="3262" RELATED="1" /> <a href="<trs_channel field=_recurl/>" id="0101" class="BlackLink"> <trs_channel autolink=false/></a></div> </trs_channels> </TRS_CONDITION> </div>