codecamp

sp_get_child_terms

sp_get_child_terms

上一页下一页

sp_get_child_terms($term_id)

功能:

返回指定分类下的子分类

参数:

$term_id 分类id

返回:

类型数组,指定分类下的子分类

示例:

<?php
 $term_id=1;
 $terms=sp_get_child_terms($term_id ); //获取子分类信息
 print_r($terms); //打印出子分类信息
?>

返回数组item说明:

term_id       分类id  

name      分类名称  

taxonomy      分类的类型,用字符串表示,article表示文章  

description      分类描述  

parent      分类父级id,terms表中的term_id  

seo_title

seo_keywords

seo_description

list_tpl      分类列表页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为list  

one_tpl      分类单文章页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为article

模板中用法:

<php>
    $term_id=1;
     $terms=sp_get_child_terms($term_id ); //获取子分类信息
</php>
<foreach name="terms" item="vo">
    {$vo.name}<!--打印出分类名称 -->
    
</foreach>

上一页下一页

sp_sql_posts_paged()
sp_get_terms()
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

后台管理

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }