$Url = GetFileUrl($aid,$arcRow['typeid'],$arcRow['senddate'],$reArr['title'],$arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);
return $Url;
}
然后将以下代码保存为 diary.lib.php 放到include/taglib 目录下
<?php
/**
* 调用当前作者文档
* @version $Id: diary.lib.php 1:37 2015年6月2日 by JJM $
* @link http://www.jjm.hk
*/
if(!defined('DEDEINC')){
exit("Request Error!");
}
function lib_diary(&$ctag,&$refObj)
{
global $dsql,$envs;
$jjmhk="row|1,typeid|0";
FillAttsDefault($ctag->CAttribute->Items,$jjmhk);
extract($ctag->CAttribute->Items);
$innertext = trim($ctag->GetInnerText());
$ctp = new DedeTagParse();
$ctp->SetNameSpace('field','[',']');
$ctp->LoadSource($innertext);
$writer = $ctag->GetAtt('writer');
if($writer=='this')
{
$writer = isset($refObj->Fields['writer']) ? $refObj->Fields['writer'] : 0;
}
$query = "select a.id,a.title,a.writer,a.pubdate,a.typeid,b.aid from dede_archives a LEFT JOIN dede_addonarticle b on b.aid=a.id where a.typeid='{$typeid}' and a.writer='{$writer}' order by a.pubdate desc LIMIT 0,$row";
$dsql->SetQuery($query);
$dsql->Execute('me',$query);
while($rs= $dsql->GetArray('me'))
{
$rs['pubdate']=GetDateMK($rs['pubdate']);
$rs['arcurl']=GetOneDocUrl($rs['id']);
$rs['title'] = 0 == $titlelen?$rs['title']:cn_substr($rs['title'], $titlelen);
$ctp->LoadSource($innertext);
foreach($ctp->CTags as$tagid=>$ctag) {
if(!empty($rs[strtolower($ctag->GetName())])) {
$ctp->Assign($tagid,$rs[$ctag->GetName()]);
}
}
$revalue.= $ctp->GetResult();
}
return $revalue;
}
最后再内容页的模板中调用以下标签,下边的li span 标签 自己修改删除。
{dede:diary row='10' typeid='2' writer='this'}
<li><a href="[field:arcurl/]">[field:title/]</a><span class="p-l5">([field:pubdate/])</span></li>
{/dede:diary}
==============================分割线============================
标签说明:
row= 调用条数
-
联系我们
客服QQ
工作时间:8:00-18:00
客服QQ
379144319
电子邮件
379144319@qq.com
-
返回顶部