Keyword

Best way for categories/items to dynamically display module?

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 5 months ago #134439 by Brian
Hi, I am trying to limit the amount of hardcoding in my site. I have category pages that all follow a similar format and I am trying to figure out the best way to have their category page views consistently display the same info without having to edit the category content in the control panel. So you can imagine a category and subcategory. Call it cat 1, with sub cats subcat1, subcat2.

Cat1 page displays (using the xperts tab module for instance)

[Description]

[Tab 1 - Latest Documents across all subcats] [Tab 2 - Latest News across all subcats]

Then likewise for the subcats - a description, but then the tabs would be subcat specific.

So I just need to know where in the code (as much as I do not want to edit core K2 code, but in this case I have to, right?) to add the logic to do this:

- If cat is cat1, render description, render xpert tabs with latest documents and news across this cat
- If parent cat is cat1, render description, render xpert tabs with latest documents and news across this subcat

Thanks!!

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

More
9 years 5 months ago #134446 by Lefteris
Hi. You can do this in a K2 template override. Information regarding this can be found at getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates . Then you can just assign the cat1 to use the default template and the subcats to use a custom template override you created.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 4 months ago #134619 by Brian
Interesting. So should I not use the category content editor and just do everything in the template? Right now I have things looking pretty good using {loadposition} calls but what I need is for the category description to be first, followed by subcat listing, then the {loadposition} results. Right now the subcat listing is last. Thanks!

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

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 4 months ago #134620 by Brian
Meant to ask, if I put all the loadposition calls in the template, will they be parsed? What would the syntax be? Just echo the calls using standard php echo call?

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

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 4 months ago #134651 by Brian
Hi,

I just tried to echo {loadposition pos} in caregories.php and that did not work. So I take it I am missing something and there is some way to properly implement loadposition in categories.php?

Thanks!!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #134664 by Krikor Boghossian
Replied by Krikor Boghossian on topic Best way for categories/items to dynamically display module?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 4 months ago #134720 by Brian
Thanks!!

That seems to be getting me closer to what I am trying to do. But I am trying to avoid creating the modules. I have subcategory pages, 9 of them, and each will have 3 tabs that display 3 types of content. So to use xperttabs, for example, I would have to create 27 modules and edit them all when I want to make changes. So I am trying to figure out how to have the template override render the module dynamically, perhaps using module display params from one actual module instance, but then rendering the item list for each tab dynamically, depending on current subcategory. That make sense? Thanks! I hope to soon answer questions and not just ask them!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #134788 by Krikor Boghossian
Replied by Krikor Boghossian on topic Best way for categories/items to dynamically display module?
i do not think that this is possible.
The module needs to be present in order to be displayed.

You can use multiple module areas in your template, some depending on your current category's id, but the module has to be both created and published

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Brian
  • Brian's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 4 months ago #135177 by Brian
Finally went live with the site:

www.pfp-consortium.org

I really need to look at dynamically implementing the tabs on the Working Group and Products pages. It will be a nightmare to have to edit modules. I need to revisit the discussion about ajax and on another forum, or maybe here, there was a recommendation to use the bootstrap framework to do the tabs, but I wasn't sure what that meant.

Thanks for all the help!!!!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #135229 by Krikor Boghossian
Replied by Krikor Boghossian on topic Best way for categories/items to dynamically display module?
Hello again.
Kudos on the site.
The method I described needs strong JS/ jQuery skills.
You do a similar thing as this plugin github.com/paulirish/infinite-scroll
You get the items from a menu link and load with jQuery in a part of your site.

As for Bootstrap they have good documentation on getbootstrap.com

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum