First, add the following methods to the/include/extend.func.php:
/**
* Dynamic address to static output by Windchaser qq:939238564
* $arcurl dynamic URL
* @return String
*
/function arcurlhtml ($ Arcurl) {
preg_match ('/view.php\?aid= (\d+)/', $arcurl, $arcid);
if (!empty ($arcid) && Is_array ($arcid)) {//Match exists dynamic address
global $dsql;
$addtable = $dsql->getone ("Select Channel.addtable from #@__channeltype as channel left JOIN #@__archives as arc on arc . channel=channel.id
WHERE arc.id= ' {$arcid [1]} ');//Get Model Type table name
$redirecturl = $dsql->getone ("Select RedirectURL from {$addtable [' addtable ']} WHERE aid = ' {$arcid [1]} ');//dynamically get table name and query redirecturl field data
if (!empty $ redirecturl[' RedirectURL ']) {
return $redirecturl [' RedirectURL '];//returns redirecturl field data
}else{
return $arcurl;
}
else{//non dynamic address return directly to the original address
$arcurl;
}
There are two forms of how you use the template:
#第一种:
[Field:arcurl function= ' arcurlhtml (@me) '/]
#第二种:
[field:id runphp= ' yes '] $id = @me; @me = '; $url = Getonearchive ($id); @me = $url [' Arcurl ']; @me =arcurlhtml (@me); [/field:id]
Full Call:
#第一种
{dede:arclist titlelen= ' channelid= '-1 ' limit= ' 0,4 ' type= commend ' flag= ' ' <li ' C '}
class= "Rtli" ><a href= "[Field:arcurl function= ' arcurlhtml (@me) '/]" title= "[field:title/]" target= "_blank" ></a></li>
{/dede:arclist}
#第二种
{dede:sql Sql= "SELECT * from Xzzj_channeltype a LEFT join xzzj_archives b ' a.id = B.channel where a.id=-1 order by B.pubdate DESC LIMIT 0,2 "}
<a href=" [field:id runphp= ' yes '] $id = @me; @me = '; $url =getonearchive ($id); @me = $url [' Arcurl ']; @me = Arcurlhtml (@me); [/field:id] "class=" S_contentrtpia "target=" _blank "title=" [field:title/] "><span class=" S_contentrtpiaspan ">[field:title/]</" Span></a>
{/dede:sql}
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.