帝国 CMS 列表页为置顶信息添加图标的方法:
<?php
$is_top = $r['istop']; // 获取是否置顶的字段值
if($is_top) {
?>
<img src="your_icon_url" alt="置顶图标" />
<?php
}
?>
在上述代码中,您需要将
your_icon_url 替换为实际的图标链接地址。
比如,如果您的图标位于网站根目录下的
images 文件夹中,名为
top_icon.png ,则代码如下:
<?php
$is_top = $r['istop'];
if($is_top) {
?>
<img src="/images/top_icon.png" alt="置顶图标" />
<?php
}
?>
或者,如果您的图标是通过网络链接获取的,比如:
<?php
$is_top = $r['istop'];
if($is_top) {
?>
<img src="https://example.com/top_icon.png" alt="置顶图标" />
<?php
}
?>
这样,当信息为置顶时,就会显示相应的图标。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END




