自定义标签的笔记,下面是一个简单的标签flink,解释一下:
<?php<BR>//检查是否定义include文件夹的路径DEDEINC<BR> if(!defined('DEDEINC')) |
function lib_flink(&$ctag,&$refObj) |
{<BR> //声明全局的数据库连接<BR> global $dsql;<BR> //标签拥有的属性和默认值<BR> $attlist="type|textall,row|24,titlelen|24,linktype|1,typeid|0"; |
FillAttsDefault($ctag->CAttribute->Items,$attlist);<BR> //将标签中的值导入到当前符号表中<BR> extract($ctag->CAttribute->Items, EXTR_SKIP); |
$wsql = " where ischeck >= '$linktype' "; |
$wsql .= "And typeid = '$typeid'"; |
$wsql .= " And logo<>'' "; |
$wsql .= " And logo='' "; |
$equery = "Select * from dede_flink $wsql order by sortrank asc limit 0,$totalrow"; |
//检查标记中是否已经包含innertext底层模板 |
if(trim($ctag->GetInnerText())=='') $innertext = "<li>[field:link /]</li>"; |