Keyword

[SOLVED] tag.php display tags and attachments

More
8 years 5 months ago - 8 years 5 months ago #153341 by Kiwee
Hi,

I use the tag.php, to display all the items using a specific tag. I overrided the tag.php using a file templates/xxx/html/com_k2/default/tag.php, it works fine.

I just need to display, for each item, the others tags and the attachments. How can I do that ?
Last edit: 8 years 5 months ago by Kiwee. Reason: solved

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 5 months ago #153388 by Krikor Boghossian
Replied by Krikor Boghossian on topic tag.php display tags and attachments
Hello,

These values are not available by default in the object.
You would have to hack the model in order to add these values.
From that point, you can use the $item->tags and $item->attachments variables in your override.

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

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

More
8 years 5 months ago - 8 years 5 months ago #153430 by Kiwee
Replied by Kiwee on topic tag.php display tags and attachments
Any idea or tips or begining of something for the hack ?
Last edit: 8 years 5 months ago by Kiwee.

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

More
8 years 5 months ago #153495 by Kiwee
Replied by Kiwee on topic tag.php display tags and attachments
I found the answer in another topic : www.joomlaworks.net/forum/k2-en/45159-solved-$item-tags-empty-in-tag-php

I know it is not recommended to edit the k2 core, but no choice, I need to display attachments and tags in the tag.php

What I did, if someone has the same problem :
/!\ BE CAREFUL /!\
always keep a backup of your edit in case of a update
always be careful when editing core files
/!\


in the /components/com_k2/models/item.php file, edit
Tags : line 107 :
if (($view == 'item' && ($item->params->get('itemTags') || $item->params->get('itemRelated'))) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemTags')) || ($view == 'itemlist' && $task == 'user' && $item->params->get('userItemTags')) || ($view == 'latest' && $params->get('latestItemTags')))
to
if (($view == 'item' && ($item->params->get('itemTags') || $item->params->get('itemRelated'))) || ($view == 'itemlist' && ($task == '' || $task == 'category' || $task == 'tag') && $item->params->get('catItemTags')) || ($view == 'itemlist' && $task == 'user' && $item->params->get('userItemTags')) || ($view == 'latest' && $params->get('latestItemTags')))

Attachments : line 187 :
if (($view == 'item' && $item->params->get('itemAttachments')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemAttachments')))
to
if (($view == 'item' && $item->params->get('itemAttachments')) || ($view == 'itemlist' && ($task == '' || $task == 'category' || $task == 'tag') && $item->params->get('catItemAttachments')))

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

More
8 years 1 month ago #157070 by Joe Campbell
Replied by Joe Campbell on topic [SOLVED] tag.php display tags and attachments
Has this limitation been resolved with the latest version of K2?

If not, can this be executed with a plugin or does it require a hack?

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


Powered by Kunena Forum