1. 标签映射存在数据库里,不在代码里
-- phome_enewsbq 表 (bqid=31,当前启用中 isclose=0)
bq='showtags' → funname='sys_eShowTags'
2. 核心:RepBq()运行时动态生成调用代码
function RepBq($indextext){
global $empire,$dbtbpre;
$sql=$empire->query("select bq,funname from {$dbtbpre}enewsbq where isclose=0 order by bqid");
while($r=$empire->fetch($sql))
{
$preg_str="/\[".$r['bq']."\](.+?)\[\/".$r['bq']."\]/is";
$indextext=preg_replace($preg_str,"<?php ".$r['funname']."(\\1);?>",$indextext);
}
return $indextext;
}
模板里写 [showtags]0,10,0,'tagid desc'[/showtags] 时,RepBq 把它替换成 <?php sys_eShowTags(0,10,0,'tagid desc');?> 内嵌到生成的页面/缓存文件中,include 执行时才真正调用。
3. 完整调用链
模板含 [showtags]...[/showtags]
→ NewsBq / InfoNewsBq / GetInfoNewsBq / DtNewsBq / DtNewsBq_dtup (functions.php)
→ RepBq() 查 enewsbq 表,正则替换成内嵌 PHP
→ 生成的页面被 include 执行 → sys_eShowTags(...)






