emlog为文章tag标签自动添加内链
1、在主题模板目录module.php文件中,?>符号之前加入以下代码
//自动标签内链 function nltag($content ,$domain) { global $CACHE; $tag_cache = $CACHE->readCache('tags'); foreach($tag_cache as $value){ $tag_url = Url::tag($value['tagurl']); $keyword=$value['tagname'];$cleankeyword=stripslashes($keyword);$url="<ahref=\"{$tag_url}\"title=\"浏览关于“{$cleankeyword}”的文章\"target=\"_blank\">{$cleankeyword}</a>";$regEx='\'(?!((<.*?)|(<a.*?)))('.$cleankeyword.')(?!(([^<>]*?)>)|([^>]*?</a>))\'s';$content=preg_replace($regEx,$url,$content);}return$content;}
2、打开echo_log.php文件
<?php echo $log_content; ?>替换为:
<?php echo nltag($log_content,$domain);?>