-
AuthorPosts
-
alecmouti Friend
alecmouti
- Join date:
- September 2013
- Posts:
- 17
- Downloads:
- 71
- Uploads:
- 0
- Thanks:
- 6
- Thanked:
- 1 times in 1 posts
August 6, 2014 at 6:29 pm #200302How can I show item tags ($this->item->tags) in mod_janews_featured version 2.5.8 ?
Please help
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
August 12, 2014 at 2:31 am #545566Hello,
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 Friendalecmouti
- Join date:
- September 2013
- Posts:
- 17
- Downloads:
- 71
- Uploads:
- 0
- Thanks:
- 6
- Thanked:
- 1 times in 1 posts
August 14, 2014 at 5:33 am #545932Thank 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 Friendalecmouti
- Join date:
- September 2013
- Posts:
- 17
- Downloads:
- 71
- Uploads:
- 0
- Thanks:
- 6
- Thanked:
- 1 times in 1 posts
August 20, 2014 at 6:11 am #546641How can I implement the same thing using K2 and JA News Featured module.. Please help?
Thanh Nguyen Viet FriendThanh Nguyen Viet
- Join date:
- September 2014
- Posts:
- 1461
- Downloads:
- 0
- Uploads:
- 44
- Thanked:
- 258 times in 217 posts
August 20, 2014 at 7:53 am #546661Hello,
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] -
AuthorPosts
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