tim*_*ker 7 php tags joomla joomla3.1
我需要获得与Joomla 3.1.5中的文章相关联的TAGS
我尝试了以下但他们没有返回一个字符串:
echo $article->item->tags->itemTags;
Run Code Online (Sandbox Code Playgroud)
和
$tags = $article->get("tags");
Run Code Online (Sandbox Code Playgroud)
只是为了记录我正在加载文章信息(使文章标题完美)
$article = JTable::getInstance("content");
$article->load(JRequest::getInt("id"));
$pageTitle = $article->get("title");
$user =& JFactory::getUser();
Run Code Online (Sandbox Code Playgroud)
Mar*_*o D 14
如果你想在模块/插件等中加载文章标签,并假设$id是文章的id,你可以这样做
$tags = new JHelperTags;
$tags->getItemTags('com_content.article', $id);
var_dump($tags);
Run Code Online (Sandbox Code Playgroud)
如果你查看components/com_content/views/article/tmpl/default.php,标签显示如下:
if ($this->params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) {
$this->item->tagLayout = new JLayoutFile('joomla.content.tags');
echo $this->item->tagLayout->render($this->item->tags->itemTags);
}
Run Code Online (Sandbox Code Playgroud)
所以你可以基于这个:
希望能帮助到你
| 归档时间: |
|
| 查看次数: |
5569 次 |
| 最近记录: |