先在module.php文件内找到文章标签
添加
if (empty($tag_names)) {
$tag .= " <a\" class='tags'>" . "本文没有标签哦!" . '</a>';
echo $tag;
}
判断为空则输出本文没有标签
完整代码:
<?php
//blog:文章标签
function blog_tag($blogid) {
global $CACHE;
$tag_model = new Tag_Model();
$log_cache_tags = $CACHE->readCache('logtags');
if (!empty($log_cache_tags[$blogid])) {
$tag = '';
foreach ($log_cache_tags[$blogid] as $value) {
$tag .= " <a href=\"" . Url::tag($value['tagurl']) . "\" class='tags' >" . $value['tagname'] . '</a>';
}
echo $tag;
} else {
$tag_ids = $tag_model->getTagIdsFromBlogId($blogid);
$tag_names = $tag_model->getNamesFromIds($tag_ids);
if (!empty($tag_names)) {
$tag = '标签:';
foreach ($tag_names as $key => $value) {
$tag .= " <a href=\"" . Url::tag(rawurlencode($value)) . "\" class='tags'>" . htmlspecialchars($value) . '</a>';
}
echo $tag;
}
if (empty($tag_names)) {
$tag .= " <a\" class='tags'>" . "本文没有标签哦!" . '</a>';
echo $tag;
}
}
}
?>