发布时间:2021-03-11 09:30:15
dede调取和当前文章短标题相同文章的方法
在extend.func.php 文件最后面添加如一下代码
\WWW\include\extend.func.php
/**
*dede调取和当前文章短标题相同的文章
*/
function s_title($shorttitle)
{
$sql = "SELECT a.shorttitle, b.* FROM dede_archives AS a INNER JOIN dede_archives as b ON a.id = b.id WHERE a.shorttitle='$shorttitle';"
$dsql->SetQuery($sql);
$dsql->Execute('t');
$result = '';
while($row = $dsql->GetArray('t'))
{
$arcrow = GetOneArchive($row['id']);
$row['arcurl'] = $arcrow['arcurl'];
$title = cn_substr($row['title'],8);
$result .= "<a href=\"{$row['arcurl']}\">{$title}</a>";
}
return $result;
}
前台模板调用方法:
{dede:field.shorttitle function="s_title(@me)"/}
上一篇: 织梦后台怎么简化?DEDECMS后台界面修改教程
下一篇: 织梦channelartlist输出下级栏目对应html标签的方法