Keyword

Category View - Keep listings of subcategories separate?

  • Justin Herrin
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 2 months ago #86333 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
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 2 months ago #86334 by Justin Herrin
Can anyone help with this?

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #86335 by sebix
I m trying too ..

Please Log in or Create an account to join the conversation.

  • Justin Herrin
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 1 month ago #86336 by Justin Herrin
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?

Please Log in or Create an account to join the conversation.

  • Justin Herrin
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 1 month ago #86337 by Justin Herrin
bump. Can anyone help with this?

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #86338 by Aaron McQueen
Justin Herrin said:bump. Can anyone help with this?


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
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 11 months ago #86339 by Justin Herrin
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!

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #86340 by Aaron McQueen
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
Attachments:

Please Log in or Create an account to join the conversation.

  • Justin Herrin
  • Justin Herrin's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 11 months ago #86341 by Justin Herrin
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!

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #86342 by Aaron McQueen
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.


Powered by Kunena Forum