# 帝国CMS相关信息模板如何调用其他字段

*Published:* 2023-12-04
*Author:* 客服001

#### 温馨提醒

如果文章内容或图片资源失效，请留言反馈，我们会及时处理，谢谢

本文最后更新于2023年12月4日，已超过 180天没有更新



帝国CMS相关信息模板默认只支持如下变量：

> 标题: \[!--title--\]
> 
> 标题alt：\[!--oldtitle--\]
> 
> 标题链接: \[!--titleurl--\]
> 
> 发布时间: \[!--newstime--\]
> 
> 标题图片: \[!--titlepic--\]

如果还想增加调用其他字段该如何实现了，我们以\[!--smalltext--\]简介字段为例，方法如下：

1、打开e/class/functions.php

2、找到：

```
$key_sql=$empire->query("select id,newstime,title,isurl,titleurl,classid,titlepic from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
```

修改成：

```
$key_sql=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add." order by newstime desc limit $link_num");
```

3、找到：

```
$temptext=str_replace("[!--newstime--]",$r[newstime],$temptext);
```

在下面添加一行：

```
$temptext=str_replace("[!--smalltext--]",$r[smalltext],$temptext);
```

4、在相关链接模板即可直接调用了

```
[!--smalltext--]
```