Keyword

which file to edit to show the tag I clicked ?

  • Robert Watson
  • Robert Watson's Avatar Topic Author
  • Offline
  • New Member
More
5 years 9 months ago - 5 years 9 months ago #172694 by Robert Watson
which file to edit to show the tag I clicked ? was created by Robert Watson
I have a K2 Tools module which lists all the K2 tags in a tag cloud .
When i click a K2 tag - all K2 items with matching tags are displayed in a list in the main body of the site.

i want to ADD THE NAME OF THE SELECTED K2 TAG to the top of the item list to show what's been selected.

I am new to sub-templating - I just need to know WHICH K2 FILE to edit to do this.

Help !!

k2 version 2.9.0
Last edit: 5 years 9 months ago by Robert Watson. Reason: clarity

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

More
5 years 9 months ago #172701 by JoomlaWorks
Replied by JoomlaWorks on topic which file to edit to show the tag I clicked ?
It's the file tag.php.

Learn how to copy K2 source template overrides into your Joomla template by reading this: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

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

  • Robert Watson
  • Robert Watson's Avatar Topic Author
  • Offline
  • New Member
More
5 years 9 months ago #172713 by Robert Watson
Replied by Robert Watson on topic which file to edit to show the tag I clicked ?
I’ve tried to override several tag.php files.

Can you be a bit more specific about the path to the tag.php file you mention.

I copied the ‘default’ file directory to my templates directory to override it.
Is it the ‘default’ folder that you mean?
I’ve done a test edit - by adding a <p> html tag and put some text in it - but nothing shows up.

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

More
5 years 9 months ago #172716 by JoomlaWorks
Replied by JoomlaWorks on topic which file to edit to show the tag I clicked ?
Source: /components/com_k2/templates/default/tag.php
Target: /templates/YOURTEMPLATE/html/com_k2/default/tag.php

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

More
5 years 9 months ago #172717 by JoomlaWorks
Replied by JoomlaWorks on topic which file to edit to show the tag I clicked ?
If caching in Joomla is enabled, you may need to clear it first to view any changes you do in your site.

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

  • Robert Watson
  • Robert Watson's Avatar Topic Author
  • Offline
  • New Member
More
5 years 9 months ago #172725 by Robert Watson
Replied by Robert Watson on topic which file to edit to show the tag I clicked ?
Thanks Fotis
Can you also give me the code snippet that will extract the tag name that was selected?

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

  • Robert Watson
  • Robert Watson's Avatar Topic Author
  • Offline
  • New Member
More
5 years 9 months ago #172726 by Robert Watson
Replied by Robert Watson on topic which file to edit to show the tag I clicked ?
Can I ask for this to be made an option on the tag view?
E.g. show selected tag name ?

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

More
5 years 9 months ago #172733 by JoomlaWorks
Replied by JoomlaWorks on topic which file to edit to show the tag I clicked ?
This should actually be default but I somehow missed it all these years. To be added in K2 v2.10.

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

  • Robert Watson
  • Robert Watson's Avatar Topic Author
  • Offline
  • New Member
More
5 years 9 months ago #172746 by Robert Watson
Replied by Robert Watson on topic which file to edit to show the tag I clicked ?
Great!!
Thanks for your help.
I managed to do it using the template override in tag.php to parse the page title from the URL.
I used PHP explode function to cut it at the colon “:” in the page title string.

Thanks Fotis

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

More
5 years 9 months ago #172756 by JoomlaWorks
Replied by JoomlaWorks on topic which file to edit to show the tag I clicked ?
You're welcome Robert :)

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


Powered by Kunena Forum