【问题标题】:Joomla get plain article tags in blog viewJoomla 在博客视图中获取普通文章标签
【发布时间】:2013-11-20 20:52:17
【问题描述】:

是否可以为每篇文章以纯文本形式获取 joomlas blogview 中的文章标签?我找到了一个 sn-p,但它在 html 中呈现文章标签...

<?php if ($params->get('show_tags', 1) && !empty($this->item->tags)) : ?>
    <?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>

    <?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>

【问题讨论】:

    标签: joomla joomla3.2


    【解决方案1】:

    标签使用 JLayout 显示。有问题的是/layouts/joomla/content/tags.php。 JLayouts 在您的模板中很容易被覆盖。 只需将该文件(或创建一个新文件)复制到templates/your_template/html/layouts/joomla/content/tags.php 并根据需要进行调整。 Joomla 将自动使用该布局来显示标签。

    【讨论】:

      【解决方案2】:

      感谢 bakual,我为我的问题找到了另一种解决方案:

      在模板blog.php中我添加了如下代码,以纯文本格式显示具体的文章标签:

      foreach ($item->tags->itemTags as $tag) echo $tag->title." "
      

      【讨论】:

        【解决方案3】:

        我把那个改成:

        <?php foreach ($item->tags->itemTags as $tag) : echo $tag->title; endforeach; ?>
        

        无论如何它都有效! 谢谢user3014931

        【讨论】:

          猜你喜欢
          • 2019-06-12
          • 2023-03-28
          • 2021-12-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-10-21
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多