how to use API16:JCategories/get

A multipurpose module, plugin and component

how to use API16:JCategories/get

New postby djemmers » Mon Mar 07, 2011 5:44 pm

Hi,

I am trying to get all the id's of the subcategories of the current category in an array so that
I can use them to interact with an external db.

the api tells me it should be easally done:
http://docs.joomla.org/API16:JCategories/get

I can get the category id
but then the trouble starts I need to do something like:
Code: Select all
jimport('joomla.application.categories');
$categories = new JCategories('com_content');//com_categories or com_jumi gives same output
print_r($categories);
echo "subs:";
$subCategories = $categories->get(78);//78 is the wanted parent category_id
print_r($subCategories);

but this gives:
Code: Select all
JCategories Object ( [_nodes:protected] => [_checkedCategories:protected] => [_extension:protected] => c [_table:protected] => c [_field:protected] => c [_key:protected] => c [_statefield:protected] => c [_options:protected] => com_jumi ) subs:


so $subCategories is empty,
I guess because JCategories is protected?

is this because I use jumi or am I doing something else wrong?
djemmers
 
Posts: 11
Joined: Mon Nov 29, 2010 4:57 pm

Re: how to use API16:JCategories/get

New postby djemmers » Tue Jun 07, 2011 10:13 am

As people keep asking me wether or not I succeded, I will reply here.

I didn't manage to get the subcategories id's but used an existing component to show a menu with all the categories.

more info in this thread:
http://forum.joomla.org/viewtopic.php?f=620&t=588443
djemmers
 
Posts: 11
Joined: Mon Nov 29, 2010 4:57 pm


Return to Jumi

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

cron