# 帝国CMS如何利用gettotal统计查询来调用当前栏目的缩略图方法

*Published:* 2023-11-28
*Author:* 客服001

#### 温馨提醒

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

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



当前[栏目](https://www.xarjtc.com/tag/%e6%a0%8f%e7%9b%ae "查看栏目此标签更多文章")ID：

```
<?=$empire->gettotal("select classid as total from {$dbtbpre}enewsclass where classid={$GLOBALS['navclassid']} limit 1")?>
```

当前栏目的[缩略图](https://www.xarjtc.com/tag/%e7%bc%a9%e7%95%a5%e5%9b%be "查看缩略图此标签更多文章")：

```
<?=$empire->gettotal("select classimg as total from {$dbtbpre}enewsclass where classid={$GLOBALS['navclassid']}  limit 1")?>
```

当前父栏目ID：

```
<?=$empire->gettotal("select classid as total from {$dbtbpre}enewsclass where classid={$class_r[$navclassid][bclassid]} limit 1")?>
```

当前父栏目的缩略图：

```
<?=$empire->gettotal("select classimg as total from {$dbtbpre}enewsclass where classid={$class_r[$navclassid][bclassid]} limit 1")?>
```

注释：调用什么字段就填写什么字段，如栏目ID：classid 、栏目图片：classimg

注意：gettotal用count(\*)时为统计，用\*时为字段；\*号也可以是字段如：classid