Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • alecmouti Friend
    #200302

    How can I show item tags ($this->item->tags) in mod_janews_featured version 2.5.8 ?

    Please help

    Thanh Nguyen Viet Friend
    #545566

    Hello,

    To use tags in JA News Featured module, please try to use solution below:
    – Open the file:
    modules/mod_janews_featured/helpers/adapter/content.php

    – Find the code snippet:
    [PHP]for ($i = 0; $i < count($rows); $i++) {[/PHP]

    – And add this code after:
    [PHP]// Get the tags
    $rows[$i]->tags = new JHelperTags;
    $rows[$i]->tags->getItemTags(‘com_content.article’, $rows[$i]->id);[/PHP]

    – Once done, you can place code block below in template file of JA News Featured module where you want to display a tags
    [PHP]<?php if (isset($news->tags) && !empty($news->tags->itemTags)) : ?>
    <?php $news->tagLayout = new JLayoutFile(‘joomla.content.tags’); ?>
    <?php echo $news->tagLayout->render($news->tags->itemTags); ?>
    <?php endif; ?>[/PHP]

    alecmouti Friend
    #545932

    Thank you Dead Code… Oh that’s very kind of you. I don’t see the tags, I forgot to mention that I’m using k2 (v2.6.8) component

    alecmouti Friend
    #546641

    How can I implement the same thing using K2 and JA News Featured module.. Please help?

    Thanh Nguyen Viet Friend
    #546661

    Hello,

    In case you use K2 source, please try to use solution below:
    – Open the file:
    modules/mod_janews_featured/helpers/adapter/k2.php

    – Find the code line:
    [PHP]require_once (JPATH_SITE . DS . ‘components’ . DS . ‘com_k2’ . DS . ‘helpers’ . DS . ‘route.php’);[/PHP]

    – And add this line after it:
    [PHP]require_once (JPATH_SITE . DS . ‘components’ . DS . ‘com_k2’ . DS . ‘models’ . DS . ‘item.php’);[/PHP]

    – And file the code line:
    [PHP]if (count($rows)) {

    foreach ($rows as $j => $row) {[/PHP]

    – And replace it with:
    [PHP]if (count($rows)) {
    $modelItem = new K2ModelItem();

    foreach ($rows as $j => $row) {
    $tags = $modelItem->getItemTags($row->id);
    for ($i = 0; $i < sizeof($tags); $i++)
    {
    $tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name));
    }
    $row->tags = $tags;[/PHP]

    – Once done, you can use code block below in template file of module to display tags
    [PHP]<?php if(count($news->tags)): ?>
    <!– Item tags –>
    <div class=”catItemTagsBlock”>
    <span><?php echo JText::_(‘K2_TAGGED_UNDER’); ?></span>
    <ul class=”catItemTags”>
    <?php foreach ($news->tags as $tag): ?>
    <li><a href=”<?php echo $tag->link; ?>”><?php echo $tag->name; ?></a></li>
    <?php endforeach; ?>
    </ul>
    <div class=”clr”></div>
    </div>
    <?php endif; ?>[/PHP]

    alecmouti Friend
    #547188

    Your solutions is perfect!!!! Thank you a million times 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

This topic contains 6 replies, has 2 voices, and was last updated by  alecmouti 10 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum