We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Channel Categories API

Development and Programming

Mario Arenas's avatar
Mario Arenas
7 posts
15 years ago
Mario Arenas's avatar Mario Arenas

Hello Everyone,

I am trying to use the API to display categories for a given group ID. However, I keep getting an error every time I run the code. Using EE 2.1.0 Build: 20100810

<?php
    $this->EE->load->library('api');
    $this->EE->api->instantiate('channel_categories');
                        
    $group_id = '1';
    $category_array = $this->EE->api->api_channel_structure->category_tree($group_id);
?>

Attached is a screenshot of the error message.

I also tried using $this->EE->api->api_channel_categories->category_tree() with the same results.

Thank you in advance for your help, Mario

       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

actually, you’re just going to want to do the following:

$this->EE->api_channel_categories->category_tree();

instead of:

$this->EE->api->api_channel_categories->category_tree();

-greg

       
Mario Arenas's avatar
Mario Arenas
7 posts
15 years ago
Mario Arenas's avatar Mario Arenas

Thank you Greg! That worked. There is a typo on the user’s guide: http://ellislab.com/expressionengine/user-guide/development/api/api_channel_categories.html

Thank you again, Mario

       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

Thanks Mario, I’ve filed a bug report, and we’ll get it fixed up before the next release!

https://support.ellislab.com/bugs/detail/14438/

       
Alex Working on EE's avatar
Alex Working on EE
16 posts
15 years ago
Alex Working on EE's avatar Alex Working on EE

Thought I’d point out that your docs still have that typo.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.