Page 1 of 1

How to get the actual category

Posted: Thu 28. Jun 2007, 08:31
by bepposun
I found in the forum the way how to use pagetitle etc.
http://www.phpwcms.de/forum/viewtopic.php?t=13841

So with $GLOBALS['content']["cat_name"]; it's possible to get the category. Fine. However I try to get the name of the category above the actual level.

Example:

Level0->Level1->Level2->Level3
I'm on Level3 and try to get the name of Level2.

Looking into the db I see that I could use table phpwcms_articlecat since there is the field acat_struct which actually contains the parent category but I'm not sure how to access this data - probably there is a simple solution?

(As you can see I just start with MySQL and PHP and phpwcms ;)

Cheers Beppo

Posted: Thu 28. Jun 2007, 12:08
by marcus@localhorst
hi,
write print_r($GLOBALS) in your script, and you will get all available data (Titel, IDs etc.) and information about naviagtion structure ($LEVEL_ID).
You know how to read an array/structure tree?
i have someting like this in mind (the structure maybe wrong $LEVEL_ID is important - it is replaced with the right cat id in structure)

$GLOBALS['content'][$LEVEL_ID[2]]["cat_name"]

grüße
marcus

Posted: Thu 28. Jun 2007, 17:52
by bepposun
Thanks, this thing print_r($GLOBALS) is really interesting.

With $GLOBALS['LEVEL_STRUCT'][3] I get the category name above the actual category (in this case).

Now I discovered that I need not the category name, but the alias. Any idea how to get this?

Regards, Joerg

Posted: Thu 28. Jun 2007, 19:07
by DeXXus