文章正文页常用函数:
1.相应文章上下文调用:
{dede:prenext function="str_replace(' 下一篇:','<'.'br'.' />下一篇:
2.文章关键字TAG调用,每个关键字附带链接地址
{dede:field name='keywords' runphp='yes' }
if(!empty(@me)){
$kws = explode(' ',@me);
@me = "";
foreach($kws as $k){
@me .= "<a href='/plus/search.php?keyword=$k' target='blank'>$k</a> ";
}
@me= str_replace('+', ' ',trim(@me));
}
{/dede:field}<BR>
3.复制相应文章地址按钮
<INPUT onclick=copyToClipBoard() type=button value=复制本页文章地址,传给QQ/MSN上的好友 name=Submit width="100" height="16">
<SCRIPT language=javascript>
function copyToClipBoard(){
var clipBoardContent="";
clipBoardContent+=document.title;
clipBoardContent+="";
clipBoardContent+=this.location.href;
window.clipboardData.setData("Text",clipBoardContent);
alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友");
</SCRIPT>
<SCRIPT>
document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + " 参考链接:"+location.href; clipboardData.setData("text", text); } }, 100 ) }
</SCRIPT>
4.文章正文评论调用
<form action="{dede:field name='phpurl' /}/feedback.php?action=send" method="post" name="feedback">
<input type="hidden" name="arcID" value="{dede:field name="id"/}">
<input name="notuser" type="hidden" id="notuser" value="1" checked>
<><LABEL for=message>内容:</LABEL><TEXTAREA id=message onfocus=showcode() name=message></TEXTAREA></P>
<><BUTTON id=submitcomm
style="ADDING-RIGHT: 30px; PADDING-LEFT: 30px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 2.8em; COLOR: #090; LINE-HEIGHT: 35px; PADDING-TOP: 0px; HEIGHT: 35px; BACKGROUND-COLOR: #ffffff" name=submitcomm type=submit value="submit">发表评论</BUTTON></P><INPUT id=itemid
type=hidden value="submit" name=itemid> </FORM>
5.调用收藏夹,添加文章到各大网站收藏夹
<!-- 添加网摘 --><STRONG><FONT color=#0e63e4>收</FONT><FONT
color=#58c600>藏</FONT><FONT color=#996699>到</FONT><FONT
color=#c00012>网</FONT><FONT color=#795f00>摘</FONT><FONT
color=#327f00>:</FONT></STRONG> <A title=Baidu搜藏
href='javascript:u=location.href;t=document.title;c%20=%20""%20+%20(window.getSelection%20? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url="http://cang.baidu.com/do/add?it="+encodeURIComponent(t)+"&iu="+encodeURIComponent(u)+"&dc="+encodeURIComponent(c)+"&fr=ien#nw=1";window.open(url,"_blank","scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes"); void 0'><IMG
alt=Baidu搜藏 src="/wm_img/baidu.gif" border=0></A> <A
href="javascript:window.open('http://shuqian.qq.com/post?title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=960,height=600,left=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)"><IMG
title=QQ书签 alt=QQ书签 src="/wm_img/qq.gif" border=0></A> <A
href="javascript:location.href='http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"><IMG
alt=Google书签 src="/wm_img/google.gif" border=0></A> <A
href="javascript:location.href='http://del.icio.us/post?&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"><IMG
title=Del.icio.us alt=Del.icio.us src="/wm_img/delicious.gif" :
border=0></A> <A title=POCO网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://my.poco.cn/fav/storeIt.php?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&img=http://www.h-strong.com/blog/logo.gif','keyit','scrollbars=no,width=475,height=575,status=no,resizable=yes'));keyit.focus();"><IMG
alt=POCO网摘 src="/wm_img/poco.gif" border=0></A> <A title=Yahoo书签 jhref="javascript:location.href='http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title)"><IMG
alt=Yahoo书签 src="/wm_img/yahoo.gif" border=0></A> <A title=新浪
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=28&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();"><IMG
alt=新浪ViVi src="/wm_img/vivi.gif" border=0></A> <A title=365Key网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();"><IMG
alt=365Key网摘 src="/wm_img/365key.gif" border=0></A> <A title=天极网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(yesky=window.open('http://hot.yesky.com/dp.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&st=2','yesky','scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes'));yesky.focus();"><IMG alt=天极网摘 src="/wm_img/yesky.gif" border=0></A> <A title=和讯网摘
href="javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!='None'?document.selection.createRange().text:'')document.getSelection?document.getSelection():'');void(open('http://bookmark.hexun.com/post.aspx?title='+escape(t)+'&url='+escape(u)+'&excerpt='+escape(e),'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes'));"><IMG
alt=和讯网摘 src="/wm_img/hexun.gif" border=0></A> <A
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(live=window.open('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url='+escape(d.location.href)+'&title='+escape(d.title)+'&top=1','live','scrollbars=no,status=no,resizable=yes'));live.focus();"><IMG
alt="Windows Live" src="/wm_img/live.gif" border=0></A> <A
# m8 O* S9 j2 f+ l2 @: U$ N$ ~3 y4 B5 m) `' U
title=鼠标选中部分作为描述,提交到diglog.com
onclick="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.diglog.com/submit.aspx?title='+escape(d.title)+'&url='+escape(d.location.href)+'&description='+escape(t),'keyit','scrollbars=yes,width=500,height=500,left=65,top=20,status=no,resizable=yes'));keyit.focus();"
href="javascript://"><IMG alt="提交新发现,Dig it" src="/wm_img/digit.gif"
border=0></A> <!-- 添加网摘结束 --><INPUT onclick=javascript:window.external.addFavorite(window.location.href,document.title) type=button value=" 加入收藏夹 " name=add>
其他调用:
<!------------------------------------站内新闻调用------------------------------------>
<UL class=***>
{dede:mynews row='7' titlelen='30'}
<LI><a href="[field:arcurl /]" target=_blank>[field:title /]</a></LI>
{/dede:mynews}
</UL>
<!------------------------------------圈子调用------------------------------------>
{dede:group row="8" orderby='threads'}
[field:groupname/]
{/dede:group}
<!------------------------------------友情链接调用------------------------------------>"
图片调用:{dede:flink type='image' row='1' col='9' titlelen='22'/}
文字调用:{dede:flink type='text' row='2' col='9' titlelen='24'/}
[<!------------------------------------热门TAG调用------------------------------------>
{dede:hotwords num='20' subday='30'/}
<!------------------------------------获取Phpwind论坛的最新主题贴子调用------------------------------------>
{dede:loop table='pw_threads' sort='tid' row='8' if=''}<br>
<a href="/bbs/read.php?tid=[field:tid/]"> ·[field:subject function="cn_substr('@me',30)"/]
([field:lastpost function="date('m-d H:M','@me')"/])</a> <br/>
{dede:loop}
-----------------------------------文章图片幻灯片显示------------------------------------>
<script language='javascript'>
linkarr = new Array();
picarr = new Array();
textarr = new Array();
var focus_width=240;
var focus_height=180;
var text_height=24;
var pics = "";
var links = "";
var texts = "";
var swf_height = focus_height+text_height;
var defJpeg = "{dede:global name='cfg_phpurl'/}/img/jpeg.jpg";
{dede:arclist type='image' att='3' row='5' function='FormatScript(@me)'}
linkarr[[field:global name=autoindex/]] = "[field:arcurl/]
picarr[[field:global name=autoindex/]] = "[field:picname/]
textarr[[field:global name=autoindex/]] = "[field:title/]";
{/dede:arclist}
for(i=1;i<picarr.length;i++){
if(picarr.indexOf("jpg")==-1 && picarr.indexOf("JPG")==-1) picarr = defJpeg;
if(pics=="") pics = picarr;
else pics += "|"+picarr;
}
for(i=1;i<linkarr.length;i++)
if(links=="") links = linkarr;
else links += "|"+linkarr;
}
for(i=1;i<textarr.length;i++){
if(texts=="") texts = textarr;
else texts += "|"+textarr;
}
document.write('<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0
width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="{dede:global name='cfg_templeturl'/}/img/slide.swf">');
document.write('<param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+;
texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="{dede:global name='cfg_templeturl'/}/img/slide.swf" )
wmode="opaque" 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="'+ focus_height +'" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
document.write('</object>'
</script>
1.相应文章上下文调用:
{dede:prenext function="str_replace(' 下一篇:','<'.'br'.' />下一篇:
2.文章关键字TAG调用,每个关键字附带链接地址
{dede:field name='keywords' runphp='yes' }
if(!empty(@me)){
$kws = explode(' ',@me);
@me = "";
foreach($kws as $k){
@me .= "<a href='/plus/search.php?keyword=$k' target='blank'>$k</a> ";
}
@me= str_replace('+', ' ',trim(@me));
}
{/dede:field}<BR>
3.复制相应文章地址按钮
<INPUT onclick=copyToClipBoard() type=button value=复制本页文章地址,传给QQ/MSN上的好友 name=Submit width="100" height="16">
<SCRIPT language=javascript>
function copyToClipBoard(){
var clipBoardContent="";
clipBoardContent+=document.title;
clipBoardContent+="";
clipBoardContent+=this.location.href;
window.clipboardData.setData("Text",clipBoardContent);
alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友");
</SCRIPT>
<SCRIPT>
document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + " 参考链接:"+location.href; clipboardData.setData("text", text); } }, 100 ) }
</SCRIPT>
4.文章正文评论调用
<form action="{dede:field name='phpurl' /}/feedback.php?action=send" method="post" name="feedback">
<input type="hidden" name="arcID" value="{dede:field name="id"/}">
<input name="notuser" type="hidden" id="notuser" value="1" checked>
<><LABEL for=message>内容:</LABEL><TEXTAREA id=message onfocus=showcode() name=message></TEXTAREA></P>
<><BUTTON id=submitcomm
style="ADDING-RIGHT: 30px; PADDING-LEFT: 30px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 2.8em; COLOR: #090; LINE-HEIGHT: 35px; PADDING-TOP: 0px; HEIGHT: 35px; BACKGROUND-COLOR: #ffffff" name=submitcomm type=submit value="submit">发表评论</BUTTON></P><INPUT id=itemid
type=hidden value="submit" name=itemid> </FORM>
5.调用收藏夹,添加文章到各大网站收藏夹
<!-- 添加网摘 --><STRONG><FONT color=#0e63e4>收</FONT><FONT
color=#58c600>藏</FONT><FONT color=#996699>到</FONT><FONT
color=#c00012>网</FONT><FONT color=#795f00>摘</FONT><FONT
color=#327f00>:</FONT></STRONG> <A title=Baidu搜藏
href='javascript:u=location.href;t=document.title;c%20=%20""%20+%20(window.getSelection%20? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text);var url="http://cang.baidu.com/do/add?it="+encodeURIComponent(t)+"&iu="+encodeURIComponent(u)+"&dc="+encodeURIComponent(c)+"&fr=ien#nw=1";window.open(url,"_blank","scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes"); void 0'><IMG
alt=Baidu搜藏 src="/wm_img/baidu.gif" border=0></A> <A
href="javascript:window.open('http://shuqian.qq.com/post?title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=960,height=600,left=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)"><IMG
title=QQ书签 alt=QQ书签 src="/wm_img/qq.gif" border=0></A> <A
href="javascript:location.href='http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"><IMG
alt=Google书签 src="/wm_img/google.gif" border=0></A> <A
href="javascript:location.href='http://del.icio.us/post?&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)"><IMG
title=Del.icio.us alt=Del.icio.us src="/wm_img/delicious.gif" :
border=0></A> <A title=POCO网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://my.poco.cn/fav/storeIt.php?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&img=http://www.h-strong.com/blog/logo.gif','keyit','scrollbars=no,width=475,height=575,status=no,resizable=yes'));keyit.focus();"><IMG
alt=POCO网摘 src="/wm_img/poco.gif" border=0></A> <A title=Yahoo书签 jhref="javascript:location.href='http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title)"><IMG
alt=Yahoo书签 src="/wm_img/yahoo.gif" border=0></A> <A title=新浪
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=28&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();"><IMG
alt=新浪ViVi src="/wm_img/vivi.gif" border=0></A> <A title=365Key网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();"><IMG
alt=365Key网摘 src="/wm_img/365key.gif" border=0></A> <A title=天极网摘
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(yesky=window.open('http://hot.yesky.com/dp.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t)+'&st=2','yesky','scrollbars=no,width=400,height=480,left=75,top=20,status=no,resizable=yes'));yesky.focus();"><IMG alt=天极网摘 src="/wm_img/yesky.gif" border=0></A> <A title=和讯网摘
href="javascript:t=document.title;u=location.href;e=document.selection?(document.selection.type!='None'?document.selection.createRange().text:'')document.getSelection?document.getSelection():'');void(open('http://bookmark.hexun.com/post.aspx?title='+escape(t)+'&url='+escape(u)+'&excerpt='+escape(e),'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes'));"><IMG
alt=和讯网摘 src="/wm_img/hexun.gif" border=0></A> <A
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(live=window.open('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url='+escape(d.location.href)+'&title='+escape(d.title)+'&top=1','live','scrollbars=no,status=no,resizable=yes'));live.focus();"><IMG
alt="Windows Live" src="/wm_img/live.gif" border=0></A> <A
# m8 O* S9 j2 f+ l2 @: U$ N$ ~3 y4 B5 m) `' U
title=鼠标选中部分作为描述,提交到diglog.com
onclick="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:'')d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.diglog.com/submit.aspx?title='+escape(d.title)+'&url='+escape(d.location.href)+'&description='+escape(t),'keyit','scrollbars=yes,width=500,height=500,left=65,top=20,status=no,resizable=yes'));keyit.focus();"
href="javascript://"><IMG alt="提交新发现,Dig it" src="/wm_img/digit.gif"
border=0></A> <!-- 添加网摘结束 --><INPUT onclick=javascript:window.external.addFavorite(window.location.href,document.title) type=button value=" 加入收藏夹 " name=add>
其他调用:
<!------------------------------------站内新闻调用------------------------------------>
<UL class=***>
{dede:mynews row='7' titlelen='30'}
<LI><a href="[field:arcurl /]" target=_blank>[field:title /]</a></LI>
{/dede:mynews}
</UL>
<!------------------------------------圈子调用------------------------------------>
{dede:group row="8" orderby='threads'}
[field:groupname/]
{/dede:group}
<!------------------------------------友情链接调用------------------------------------>"
图片调用:{dede:flink type='image' row='1' col='9' titlelen='22'/}
文字调用:{dede:flink type='text' row='2' col='9' titlelen='24'/}
[<!------------------------------------热门TAG调用------------------------------------>
{dede:hotwords num='20' subday='30'/}
<!------------------------------------获取Phpwind论坛的最新主题贴子调用------------------------------------>
{dede:loop table='pw_threads' sort='tid' row='8' if=''}<br>
<a href="/bbs/read.php?tid=[field:tid/]"> ·[field:subject function="cn_substr('@me',30)"/]
([field:lastpost function="date('m-d H:M','@me')"/])</a> <br/>
{dede:loop}
-----------------------------------文章图片幻灯片显示------------------------------------>
<script language='javascript'>
linkarr = new Array();
picarr = new Array();
textarr = new Array();
var focus_width=240;
var focus_height=180;
var text_height=24;
var pics = "";
var links = "";
var texts = "";
var swf_height = focus_height+text_height;
var defJpeg = "{dede:global name='cfg_phpurl'/}/img/jpeg.jpg";
{dede:arclist type='image' att='3' row='5' function='FormatScript(@me)'}
linkarr[[field:global name=autoindex/]] = "[field:arcurl/]
picarr[[field:global name=autoindex/]] = "[field:picname/]
textarr[[field:global name=autoindex/]] = "[field:title/]";
{/dede:arclist}
for(i=1;i<picarr.length;i++){
if(picarr.indexOf("jpg")==-1 && picarr.indexOf("JPG")==-1) picarr = defJpeg;
if(pics=="") pics = picarr;
else pics += "|"+picarr;
}
for(i=1;i<linkarr.length;i++)
if(links=="") links = linkarr;
else links += "|"+linkarr;
}
for(i=1;i<textarr.length;i++){
if(texts=="") texts = textarr;
else texts += "|"+textarr;
}
document.write('<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0
width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="{dede:global name='cfg_templeturl'/}/img/slide.swf">');
document.write('<param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+;
texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="{dede:global name='cfg_templeturl'/}/img/slide.swf" )
wmode="opaque" 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="'+ focus_height +'" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
document.write('</object>'
</script>
[转自:http://ml365.iteye.com/blog/839466]