在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)"/}