Joomla:从标签模块

时间:2015-07-08 08:52:14

标签: php joomla

所以我有一个模板,为了设计我的博客,我在我的模板文件夹中的html /文件夹中使用了blog.php和blog_items.php。所以现在我正在进行标记搜索,现在不在com_content中,它在com_tags中。所以我创建了一个文件夹com_tags,里面有一个标签文件夹,因为我希望帖子在标签搜索和常见博客视图中看起来一样,我只是将blog_item.php复制到我的新文件夹,将其重命名为default_item。我在default_items.php中包含该文件没有问题,但是$ this-&gt;项似乎与com_content组件中的项不同。所以,我的代码,尤其是在使用类似的行时 <?php echo JLayoutHelper::render('joomla.content.blog_style_default_item_title', $this->item); ?>

会产生很多错误,例如,$ this-&gt; item-&gt; title未设置。因此,在使用print_r进行调查后,我创建了一个简单的解决方法:

$params = JComponentHelper::getParams('com_content');
$this->params=$params;
$this->item->params=$params;
$this->item->title=$this->escape($this->item->core_title);
$this->item->state=$this->escape($this->item->core_state);
$this->item->publish_up=$this->escape($this->item->core_publish_up);
$this->item->publish_down=$this->escape($this->item->core_publish_down);
$this->item->images=$this->escape($this->item->core_images);
$this->item->introtext = $this->item->text;

但是这样的解决方法不会让我得到文章的命中,因为没有core_hits变量,这段代码看起来很愚蠢。我该怎么做呢?

0 个答案:

没有答案
相关问题