Home >Backend Development >PHP Tutorial >$CATEGORY array in phpcms_PHP tutorial
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
)
)