Home > Backend Development > PHP Tutorial > $CATEGORY array in phpcms_PHP tutorial

$CATEGORY array in phpcms_PHP tutorial

WBOY
Release: 2016-07-15 13:21:28
Original
939 people have browsed it

1. Purpose
$CATEGORY is a two-dimensional array, mainly used to save the basic configuration information of the current channel or module and all columns.

2. How to set up
You can log in to the backend to enter the column management of the module or channel, and then modify any column setting online to change the parameter value. Modifying the column parameter setting system will update the value of the corresponding record in phpcms_category, and cache the basic information array of each column to ./data/cache/category_channel ID.php. The system will automatically load each time a module or channel with a column is accessed. Basic configuration information of its columns.

3. Scope of action
The $CATEGORY array is loaded by default by the system and can be called in any php files and templates of the current module or channel.

How to load the column information of another module or channel?
$product_cats = cache_read('categorys_product.php'); //How to load product module column information
$cats_1 = cache_read('categorys_1.php'); //Method to load column information with channel ID 1

4. Array elements
The following takes the default installed article channel as an example

Array
(
[1] => Array
(
[module] => article
                                                                                                                                                                [channelid] => 1
                                                                                                  [catid] => [Catname] = & gt; News
                                                                                                                                                                                                                                                            [style] =>                                              [introduce] =>                                                                                                   [catpic] =>                                                                                     [islink] => [catdir] => xinwen
[linkurl] => /2007/phpcms/article/xinwen/
                                                                                                                                                                                                                                          [parentid] =>                                        [arrparentid] => 0
[Parentdir] = & gt; /
                                                                                                                                                                                                                                          [child] => 1
                      [arrchildid] => 1,2,3
                                                                                                      [items] =>                                                  [itemordertype] => [itemtarget] => 0
                                             [ismenu] =>                                                                                                                                                                     [islist] => 1
                                                                                                                                  [ishtml] => 1
[htmldir] => list
[prefix] => list_
                                                   [urlruleid] =>                 [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、如何设置 您可以登录后台进入模块或者频...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template