Page 1 of 1

How to check for main category

Posted: 07 Jul 2012, 17:15
by nbarten
Hi all,

I have it made so that when a user clicks on my 'photos' menu item, he or she will go directly to the page where subcategories or images of the main category are listed (because i don't want them to see the main category). My goal is to only have subcategories (and no images) in the main category, and only images in the subcategories.

Now, when a user (the author) logs in via the frontend, he or she can directly create a subfolder or upload an image. This can be done in the subcategories overview, and the photo's overview. However, when the user is in the subcategorie overview (inside the main category), i want him only to be able to create (or edit) subcategories, so no photo upload tab. But when the user is in the photo overview view (inside the subcategory), i want him only to be able to upload photo's (and no creating subcategories).

I found the code where the tabs are made, so i know how to hide them. I only need the condition: how can i find out if he's 'inside' the main category (subcategories overview view) or 'inside' a subcategory (photo overview view) ?

Re: How to check for main category

Posted: 12 Jul 2012, 18:15
by Jan
Hi, you should get the GET parameter with tab=

Jan

Re: How to check for main category

Posted: 12 Jul 2012, 20:34
by nbarten
Hi,

Thanks for replying.

When i var_dump the $_GET, i get this:

array(4) { ["Itemid"]=> string(3) "127" ["option"]=> string(16) "com_phocagallery" ["view"]=> string(8) "category" ["id"]=> string(1) "2" }

No 'tab' parameter in there?

Re: How to check for main category

Posted: 14 Jul 2012, 22:10
by Jan
Hmmm then the first tab is displayed if no one is set by GET :-( ... so then you need to customize in the code - to change the tab number to higher value, etc. :idea:

Jan

Re: How to check for main category

Posted: 14 Jul 2012, 23:10
by nbarten
Ah found it.

I just can use

Code: Select all

$this->category->parent_id
.

If its value is '0', then i'm in the main category (only subcategories visible), and if it has a value higher than 0, i'm in a subcategory (only photo's visible).

Re: How to check for main category

Posted: 17 Jul 2012, 15:04
by Jan
Ok