if(!defined('DEDEINC')){
exit("Request Error!");
}
/**
* 调用栏目内容
*
* @version $Id: about.lib.php $
* @copyright Copyright JJM
* @link http://www.jjm.hk
*/
function lib_about(&$ctag,&$refObj)
{
global $dsql,$envs;
//属性处理
$attlist="aid|0,length|200,html|yes";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$content = '';
$aid = trim(ereg_replace('[^0-9]','',$aid));
$query = "Select content from `dede_arctype` where id='".$aid."'";
$arcRow = $dsql->GetOne($query);
if(!is_array($arcRow)) {
return $content;
}
if($html=='yes')
{
$body=html2text($arcRow['content']);
}
else if($html=='no')
{
$body=$arcRow['content'];
}
if(isset($arcRow['content'])) {
$content = cn_substr($body,$length);
}
return $content;
}
以上内容保存为about.lib.php 放到include\taglib 目录下
模板中使用以下标签调用
{dede:about aid='1' length='250' html='no'}{/dede:about}aid 栏目ID
length 调用字数
html 是否过滤HTML标签 YES为过滤 no 为不过滤