我们想为Joomla新闻Flash模块创建一个替代,该模块应该能够在前端显示各个Joomla文章标签:“标签1,标签2,标签3等。”
rockettheme.com的RokSproket能够准确地实现该输出。但是,我们希望使用newsflash模块具有相同的结果。当前,我们在新的_item.php覆盖中保存了以下代码。前端没有错误消息,但是也没有可见的标签。非常感谢您的帮助。
<?php if ($params->get('show_tags', 1) && !empty($item->tags)) : ?>
<?php $item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $item->tagLayout->render($item->tags->itemTags); ?>
<?php endif; ?>
这是我们解决该问题的方法:
<?php
$itemtags = (new JHelperTags)->getItemTags('com_content.article', $item->id);
$taglayout = new JLayoutFile('joomla.content.tags');
$tags='';
if( !empty($itemtags) )
$tags = '<div class="itemtags">'.str_replace(',','',$taglayout->render($itemtags)).'</div>';
?>
<?php echo $tags; ?>