开发者

joomla - where is category ordering stored?

开发者 https://www.devze.com 2023-04-01 11:01 出处:网络
I have a question that might seem simple, but yet I was unable to find the answer. Unlike articles, which are stored in table jos_content, categories in table jos_categories lack any column named orde

I have a question that might seem simple, but yet I was unable to find the answer. Unlike articles, which are stored in table jos_content, categories in table jos_categories lack any column named ordering or any other that would have the desired information stored. I also tried to find anything similar in the jos_assets table, but it did not help either.

I am hacking the content component a little and I need to get my child categories ordered by the ordering when calling $parent->getChildren() or just find the ordering column so I can create my own query even though it's not clean, I just need to get it working ASAP.

So where can I find category ordering or how do开发者_运维知识库 I force getChildren method to return ordered results?

Thanks in advance, Elwhis


In Joomla categorises' order is stored in table "jos_categories" as hierarchical tree structure with a set of linked nodes. Columns used to set order are: "parent_id", "lft", "rgt" and "level".

Assets and menu items are stored in the same way.

You can read more about "Tree traversal" on wiki

Edit: From Joomla 1.6 to load a specific category and all its children in a JCategoryNode object use:

jimport( 'joomla.application.categories' );

$extension = 'Content'; // com_content
$options['countItems'] = true;
$categoryId = 0;

$categories = JCategories::getInstance($extension, $options);
$categories->get($categoryId);
0

精彩评论

暂无评论...
验证码 换一张
取 消