Forums / Cotonti / Support / Question about page categories

orestes
#1 2009-06-24 22:25
Hi.

When selecting the pages I found that the category in the sed_structure table is page_cat, the alphanumeric code ( I think this is the way since LDU times...).

Imagine that you have the news category (path 1) and the subcats "national" (code 1.1) and "international" (code 1.2). If I want to select all the news, I must do the selection using the "national" and "international" text. Ok, I can name the subcats as "news_national" and "news_international" and do the select as page_cat like 'news%', but this is not the right way of doing the things as the web admin can name the categories freely.

Wouldn´t it be better to have the pages categories structured like parent_cat and cat_path, being the later an optional field, filled only if the page is from a subcategory? This manner you can select all the pages from a category and related subcategories.

Or...

Does exist a method to have selectable categories using the parent category code?

Regards!
orestes
Lombi
#2 2009-06-24 22:32
Well a much simpler way to do it which wouldnt require developers to change code is to combine the information of two tables - one being sed_structure (where your requested information already exists) and applying it as a select to sed_pages afterwards.

Also you can look at how this is done in the news plugin, where it's been working like that since day one.
<a href="http://www.domenlo.com">Surreal Art</a>
orestes
#3 2009-06-25 15:34
Thanks. I´ll look at the news plugin!!
orestes