- Posts: 2
COMMUNITY FORUM
Hide empty subcategories
- Bram Van Grimberge
-
Topic Author
- Offline
- New Member
Less
More
14 years 3 months ago #93739
by Bram Van Grimberge
Hide empty subcategories was created by Bram Van Grimberge
Hi,
I'm trying to hide empty subcategories (categories containing 0 items) but I can't seem to find this in the settings. I've searched the forum for this topic, but the solution was on a site that is no longer available (gworldz.com)
The page for which I want to hide the empty subcategories: www.hqgames.be/test/joomla/index.php/spellen
I've looked at the category.php code and I know I should hide the div with class 'subCategoryContainer'
when "$subCategory->numOfItems" equals 0. Bit I am not familiar with php to accomplish this.
Can Anyone help me out?
thank you!
I'm trying to hide empty subcategories (categories containing 0 items) but I can't seem to find this in the settings. I've searched the forum for this topic, but the solution was on a site that is no longer available (gworldz.com)
The page for which I want to hide the empty subcategories: www.hqgames.be/test/joomla/index.php/spellen
I've looked at the category.php code and I know I should hide the div with class 'subCategoryContainer'
when "$subCategory->numOfItems" equals 0. Bit I am not familiar with php to accomplish this.
Can Anyone help me out?
thank you!
Please Log in or Create an account to join the conversation.
- Roger Edrinn
-
- Offline
- Senior Member
Less
More
- Posts: 55
14 years 3 months ago #93740
by Roger Edrinn
Replied by Roger Edrinn on topic Hide empty subcategories
I don't have THE answer, but from what I've learned you need to do this:
Go the global parameters and set to hide categories
Do the same for Categories and sub categories because they are usually set to inherit from the higher category
Now for the Non-empty subcategories, set them to show individually
There is no global way to set empty to hide.
Happy K2 :)
Go the global parameters and set to hide categories
Do the same for Categories and sub categories because they are usually set to inherit from the higher category
Now for the Non-empty subcategories, set them to show individually
There is no global way to set empty to hide.
Happy K2 :)
Please Log in or Create an account to join the conversation.
- marioglez
-
- Offline
- New Member
Less
More
- Posts: 16
14 years 3 months ago #93741
by marioglez
Replied by marioglez on topic Hide empty subcategories
You have to use an if statement in php in the categories template file...
Please Log in or Create an account to join the conversation.
- Eminov Merdan
-
- Offline
- New Member
Less
More
- Posts: 1
14 years 2 months ago #93742
by Eminov Merdan
Replied by Eminov Merdan on topic Hide empty subcategories
So, what you were had to do is to go to /components/com_k2/templates/default/category.php, and find div with class 'subCategoryContainer' press "-" sign( that near the line numbers) on this line and write around this <div> if statement, So, you'll have next picture!
I've been using Notepad++
P.S.: Thank you all! I was solving the same problem and i'm very very new to Joomla and especially to K2
I've been using Notepad++
P.S.: Thank you all! I was solving the same problem and i'm very very new to Joomla and especially to K2
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
Less
More
- Posts: 3722
14 years 2 months ago #93743
by william white
Replied by william white on topic Hide empty subcategories
@ eminov Nice Code!
Please Log in or Create an account to join the conversation.
- star R.
-
- Offline
- New Member
Less
More
- Posts: 6
13 years 7 months ago #93744
by star R.
Replied by star R. on topic Hide empty subcategories
It is difficult to find exactly what to look for and change in the category.php override file. It is also unclear if this code should simply be added, or if something should be changed instead.
Perhaps you can just post the code to search for, then paste the correction below that.
Thanks
Perhaps you can just post the code to search for, then paste the correction below that.
Thanks
Please Log in or Create an account to join the conversation.