<?php
import('TagLib');
class TagLibHome extends TagLib{
protected $tags=array(
'nav'=>array('attr'=>'limit,order','close'=>1)
);
public function _nav($attr,$content){
$attr=$this->parseXmlAttr($attr);
$str=<<<str
<?php
\$cate=M('cate')->order("{$attr['order']}")->limit({$attr['limit']})-select();
import('Class.Category',APP_PATH);
\$cate=Category::unlimitedForLayer(\$cate);
foreach(\$cate as \$v):
?>
str;
$str.=$content;
$str.='<?php endforeach;?>';
return $str;
}
} 最佳答案