Keyword

Tag subtemplte does not override

  • krmr
  • krmr's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 5 months ago - 6 years 5 months ago #164974 by krmr
Tag subtemplte does not override was created by krmr
Hi there!
I have an issue with overriding tag.php template. I got 2 sub templates for 2 different categories in /mytemplate/html/com_k2/.
Then I use k2 tools tag cloud functionality as a submenu, and all tag links generate tag listings in the default template.
I am sure I have done everything right. Reinstalled K2 several times. J3.8.1 K2 2.8.0.
Please give some hints what might be the cause of this!
greetings

The two instances of K2 tools tag cloud modules are published here: 2017.sklada.bg/bg/novini/ and here: 2017.sklada.bg/bg/izbrani-brandove/
As it might be seen the tag template in the second link is OK since it follows the menu link template (category), but in the first link as soon as any of the two submenu links (tags) "изложба | изложения" is clicked the tag listing has a template that has nothing to do with the previous view
Last edit: 6 years 5 months ago by krmr. Reason: url submitting

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

More
6 years 5 months ago #164975 by william white
Replied by william white on topic Tag subtemplte does not override
Are you overriding mod_k2_tools If not you probably should, and there is a tag.php file there. The structure of the override may be a bit different than a normal k2 category override, and you will probably only be able to use one instance of it unless you create a copy of the module, rename it and override it for the second version.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 5 months ago #164980 by Krikor Boghossian
Replied by Krikor Boghossian on topic Tag subtemplte does not override
Hello,

The template can be applied on a per-menu item basis.
This means that you need to map specific tags in your menu item in order to enforce a custom template.

Another way to approach this is to add if/else statements in your override and depending on the context (eg: a referrer) and alter the view.

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

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

  • krmr
  • krmr's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 4 months ago #165003 by krmr
Replied by krmr on topic Tag subtemplte does not override
Thank you very much William White, and apologies for my delayed reply!

I am overriding mod_k2_tools, and modified tags.php in the module folder. However, it is only one instance of the module indeed that I can override, as far as my knowledge reaches, no?
I expected that if I modify the tag.php file located in each of the overriden sub-template of k2 - my-template/html/com_k2/my-sub-template
then each instance of mod_k2_tools would display tag-cloud from a specified category (as provided in the module options), and then each tag will display items selected by the tag, using the template specified by tag.php at the category sub-template folder.
Lofical, isn't it?

Thanks for your suggestion, but could you elaborate on the structure of the override you mean. I can't guess what I could do. And yea, I would need more than one instance.
Is it possible?

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

  • krmr
  • krmr's Avatar Topic Author
  • Offline
  • Senior Member
More
6 years 4 months ago #165004 by krmr
Replied by krmr on topic Tag subtemplte does not override
Thank you Krikor, for being punctual as usual! And apologies for my delayed reply!

In my case I can not map tags to menu items, because the idea of using the tag cloud as a sub-menu is to leave the user to free tag items (type of events in the news menu, and type of brands in the second), so I do not know in advance all the tags.

I think the only way to do it is following your suggestion - if/else statements in the tags.php, but I can't think of what would be the proper syntax for a query, echoing the tags, checking the category and applying certain template if/else.

Could you help in that?

You have been always of great support. Thank you!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #165118 by Krikor Boghossian
Replied by Krikor Boghossian on topic Tag subtemplte does not override
I have to be honest, this requires medium to strong coding skills.
You can create variables depending on the parent menu item or based on URLs. Some food for thought : github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L28-L36

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