首页  >  文章  >  后端开发  >  phpcms中的$CATEGORY 数组_PHP教程

phpcms中的$CATEGORY 数组_PHP教程

WBOY
WBOY原创
2016-07-15 13:21:28918浏览

1、用途
$CATEGORY 是一个二维数组,主要用来保存当前频道或者模块所以栏目的基本配置信息。

2、如何设置
您可以登录后台进入模块或者频道的栏目管理,然后在线修改任何一个栏目设置即可改变参数值。修改栏目参数设置系统会更新phpcms_category里相应记录的值,同时把各栏目基本信息数组缓存到 ./data/cache/category_频道ID.php ,每次访问有栏目的模块或频道时系统会自动加载其栏目基本配置信息。

3、作用范围
$CATEGORY 数组是系统默认加载的,可以在当前模块或频道的任何php文件和模板中调用。

如何加载另一个模块或者频道的栏目信息呢?
$product_cats = cache_read('categorys_product.php'); //加载product模块栏目信息的方法
$cats_1 = cache_read('categorys_1.php'); //加载频道ID为1的栏目信息的方法

4、数组元素
下面以默认安装的文章频道为例

Array
(
    [1] => Array
        (
            [module] => article
            [channelid] => 1
            [catid] => 1
            [catname] => 新闻
            [style] =>
            [introduce] =>
            [catpic] =>
            [islink] => 0
            [catdir] => xinwen
            [linkurl] => /2007/phpcms/article/xinwen/
            [parentid] => 0
            [arrparentid] => 0
            [parentdir] => /
            [child] => 1
            [arrchildid] => 1,2,3
            [items] => 0
            [itemordertype] => 0
            [itemtarget] => 0
            [ismenu] => 1
            [islist] => 1
            [ishtml] => 1
            [htmldir] => list
            [prefix] => list_
            [urlruleid] => 0
            [item_prefix] =>
            [item_html_urlruleid] => 0
            [item_php_urlruleid] => 0
        )

    [5] => Array
        (
            [module] => article
            [channelid] => 1
            [catid] => 5
            [catname] => 国内军事
            [style] =>
            [introduce] =>
            [catpic] =>
            [islink] => 0
            [catdir] => guonajunshi
            [linkurl] => /2007/phpcms/article//guonajunshi/
            [parentid] => 4
            [arrparentid] => 0,4
            [parentdir] => /junshi/
            [child] => 0
            [arrchildid] => 5
            [items] => 0
            [itemordertype] => 0
            [itemtarget] => 0
            [ismenu] => 1
            [islist] => 1
            [ishtml] => 1
            [htmldir] => list
            [prefix] => list_
            [urlruleid] => 0
            [item_prefix] =>
            [item_html_urlruleid] => 0
            [item_php_urlruleid] => 0
        )

    [2] => Array
        (
            [module] => article
            [channelid] => 1
            [catid] => 2
            [catname] => 国内新闻
            [style] =>
            [introduce] =>
            [catpic] =>
            [islink] => 0
            [catdir] => guonaxinwen
            [linkurl] => /2007/phpcms/article//guonaxinwen/
            [parentid] => 1
            [arrparentid] => 0,1
            [parentdir] => /xinwen/
            [child] => 0
            [arrchildid] => 2
            [items] => 5
            [itemordertype] => 0
            [itemtarget] => 0
            [ismenu] => 1
            [islist] => 1
            [ishtml] => 1
            [htmldir] => list
            [prefix] => list_
            [urlruleid] => 0
            [item_prefix] =>
            [item_html_urlruleid] => 0
            [item_php_urlruleid] => 0
        )

    [3] => Array
        (
            [module] => article
            [channelid] => 1
            [catid] => 3
            [catname] => 国外新闻
            [style] =>
            [introduce] =>
            [catpic] =>
            [islink] => 0
            [catdir] => guowaixinwen
            [linkurl] => /2007/phpcms/article//guowaixinwen/
            [parentid] => 1
            [arrparentid] => 0,1
            [parentdir] => /xinwen/
            [child] => 0
            [arrchildid] => 3
            [items] => 2
            [itemordertype] => 0
            [itemtarget] => 0
            [ismenu] => 1
            [islist] => 1
            [ishtml] => 1
            [htmldir] => list
            [prefix] => list_
            [urlruleid] => 0
            [item_prefix] =>
            [item_html_urlruleid] => 0
            [item_php_urlruleid] => 0
        )

    [4] => Array
        (
            [module] => article
            [channelid] => 1
            [catid] => 4
            [catname] => 军事
            [style] =>
            [introduce] =>
            [catpic] =>
            [islink] => 0
            [catdir] => junshi
            [linkurl] => /2007/phpcms/article/junshi/
            [parentid] => 0
            [arrparentid] => 0
            [parentdir] => /
            [child] => 1
            [arrchildid] => 4,5
            [items] => 0
            [itemordertype] => 0
            [itemtarget] => 0
            [ismenu] => 1
            [islist] => 1
            [ishtml] => 1
            [htmldir] => list
            [prefix] => list_
            [urlruleid] => 0
            [item_prefix] =>
            [item_html_urlruleid] => 0
            [item_php_urlruleid] => 0
        )

)

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477162.htmlTechArticle1、用途 $CATEGORY 是一个二维数组,主要用来保存当前频道或者模块所以栏目的基本配置信息。 2、如何设置 您可以登录后台进入模块或者频...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn