COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Category View - Keep listings of subcategories separate?
Category View - Keep listings of subcategories separate?
- Justin Herrin
- Topic Author
- Offline
- Junior Member
Less
More
14 years 2 months ago #86333
by Justin Herrin
Category View - Keep listings of subcategories separate? was created by Justin Herrin
Hello all,I'm trying to get K2 (or a custom template) to display a single page with the subcategories and their individual items listed separated out. Example...Page Title - Parent Category title- Subcategory 1 title-- Subcategory 1 Item 1-- Subcategory 1 Item 2- Subcategory 2 title-- Subcategory 2 Item 1-- Subcategory 2 Item 2Anyone know how to make this work? I don't mind creating a custom template, I just can't figure out what the coding would be...
Please Log in or Create an account to join the conversation.
- Justin Herrin
- Topic Author
- Offline
- Junior Member
14 years 2 months ago #86334
by Justin Herrin
Replied by Justin Herrin on topic Category View - Keep listings of subcategories separate?
Can anyone help with this?
Please Log in or Create an account to join the conversation.
- sebix
- Offline
- New Member
Less
More
- Posts: 1
14 years 2 months ago #86335
by sebix
Replied by sebix on topic Category View - Keep listings of subcategories separate?
I m trying too ..
Please Log in or Create an account to join the conversation.
- Justin Herrin
- Topic Author
- Offline
- Junior Member
14 years 1 month ago #86336
by Justin Herrin
Replied by Justin Herrin on topic Category View - Keep listings of subcategories separate?
I have been playing my own template, and I'm almost there, but it still needs that final bit of code that I can't figure out.
What I have displays my page like this...
Page Title - Parent Category title
- Subcategory 1 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2
- Subcategory 2 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2
As you can see, ALL items are showing under each subcategory, instead of just that specific subcategory's items. A bit frustrating so say the least.
Does anyone have any ideas for a fix?
What I have displays my page like this...
Page Title - Parent Category title
- Subcategory 1 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2
- Subcategory 2 title
-- Subcategory 1 Item 1
-- Subcategory 1 Item 2
-- Subcategory 2 Item 1
-- Subcategory 2 Item 2
As you can see, ALL items are showing under each subcategory, instead of just that specific subcategory's items. A bit frustrating so say the least.
Does anyone have any ideas for a fix?
Please Log in or Create an account to join the conversation.
- Justin Herrin
- Topic Author
- Offline
- Junior Member
14 years 1 month ago #86337
by Justin Herrin
Replied by Justin Herrin on topic Category View - Keep listings of subcategories separate?
bump. Can anyone help with this?
Please Log in or Create an account to join the conversation.
- Aaron McQueen
- Offline
- New Member
Less
More
- Posts: 3
13 years 11 months ago #86338
by Aaron McQueen
Replied by Aaron McQueen on topic Category View - Keep listings of subcategories separate?
Justin Herrin said:bump. Can anyone help with this?
I have an answer. Is there anyway to post code on here?
I have an answer. Is there anyway to post code on here?
Please Log in or Create an account to join the conversation.
- Justin Herrin
- Topic Author
- Offline
- Junior Member
13 years 11 months ago #86339
by Justin Herrin
Replied by Justin Herrin on topic Category View - Keep listings of subcategories separate?
Hello Aaron - you can just attach a .txt file with the code (using the Upload a File button) or try to copy/paste into the editor.
Thanks in advance!
Thanks in advance!
Please Log in or Create an account to join the conversation.
- Aaron McQueen
- Offline
- New Member
Less
More
- Posts: 3
13 years 11 months ago #86340
by Aaron McQueen
Replied by Aaron McQueen on topic Category View - Keep listings of subcategories separate?
Ok, here is what I did. I couldn't find a way to find the children of category, so I looped through all the categories and then looped through every item and checked to see if it was in the category. Attached is the code for category.php and category_item.php. This may be slow, and I haven't tried it with a large number of items. My guess is that it will fine.
Warning: create a new teamplate, do not overwrite the default. These are very stripped down versions of the templates, with a lot of features disabled, but in my case I don't what the user to have all of the options. They just need to add new items and they show up on the page.
Here is the example: umdphysics.umd.edu/white-pages-new
Warning: create a new teamplate, do not overwrite the default. These are very stripped down versions of the templates, with a lot of features disabled, but in my case I don't what the user to have all of the options. They just need to add new items and they show up on the page.
Here is the example: umdphysics.umd.edu/white-pages-new
Please Log in or Create an account to join the conversation.
- Justin Herrin
- Topic Author
- Offline
- Junior Member
13 years 11 months ago #86341
by Justin Herrin
Replied by Justin Herrin on topic Category View - Keep listings of subcategories separate?
Hello Aaron - Thanks for providing your code, this is exactly what I was needing!
I have tested it with my categories and all is working well in my development area. My production site will have roughly 50 items spread throughout 6 subcategories, so hopefully speed is not an issue.
Thanks again, it's much appreciated!
I have tested it with my categories and all is working well in my development area. My production site will have roughly 50 items spread throughout 6 subcategories, so hopefully speed is not an issue.
Thanks again, it's much appreciated!
Please Log in or Create an account to join the conversation.
- Aaron McQueen
- Offline
- New Member
Less
More
- Posts: 3
13 years 11 months ago #86342
by Aaron McQueen
Replied by Aaron McQueen on topic Category View - Keep listings of subcategories separate?
Glad I could help. It would have really helped me if there was documentation on the K2 objects and their properties. From the template I had to print out the object contents to find the correct properties I needed to make the loop. I really like K2 but the documentation is lacking.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Category View - Keep listings of subcategories separate?