How to check for main category

Phoca Gallery - image gallery extension
nbarten
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jul 2012, 17:01

How to check for main category

Post 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) ?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to check for main category

Post by Jan »

Hi, you should get the GET parameter with tab=

Jan
If you find Phoca extensions useful, please support the project
nbarten
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jul 2012, 17:01

Re: How to check for main category

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to check for main category

Post 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
If you find Phoca extensions useful, please support the project
nbarten
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jul 2012, 17:01

Re: How to check for main category

Post 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).
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to check for main category

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply