前面博客吧有分享过zblog通过GetCategoryList函数调用后台分类管理所有分类目录的代码,今天博客吧分享另一个调用所有分类的代码$categorysbyorder,两个代码的主要区别是,后者不能设置参数,前者可以根据需要添加各种参数,比如分类排序。
使用示例
在前端模板使用
| 1 2 3 | {foreach $categorysbyorder as $cat} <a href="{$cat->Url}">{$cat->Name}</a> {/foreach} | 
在include里使用
| 1 2 3 4 5 6 7 8 | function boke8_getCategories(){ global $zbp; $categries = ''; foreach($zbp->categorysbyorder as $categoryitem){ $categries .= '<a href="'.$categoryitem->Url.'">'.$categoryitem->Name.'</a>'; } return $categries; } | 
代码很简单,就是一个遍历输出。
 
								 
								 
								 
								 
								 
								 
								 
								 
					 
					 
					