【发布时间】:2014-11-30 22:09:17
【问题描述】:
我正在使用 Joomla 3.3 在自己的模板中工作 我已经在我的模板中创建了一个自定义类别博客
mytemplate\html\com_content\category
现在我需要制作另一个自定义类别模板,例如 news.php 或 products.php。
我需要在我的模板中有多个自定义类别的博客。我可以从菜单管理器中选择类别博客模板的类型。
如何做到这一点?
【问题讨论】:
我正在使用 Joomla 3.3 在自己的模板中工作 我已经在我的模板中创建了一个自定义类别博客
mytemplate\html\com_content\category
现在我需要制作另一个自定义类别模板,例如 news.php 或 products.php。
我需要在我的模板中有多个自定义类别的博客。我可以从菜单管理器中选择类别博客模板的类型。
如何做到这一点?
【问题讨论】:
我已经通过解决方法解决了这个问题。
在mytemplate\html\com_content\category/blog.php
我添加了一些条件语句,例如;
if($this->pageclass_sufx=='x')
echo $this->loadTemplate('item');//which is acts as blog_item.php
elseif($this->pageclass_sufx=='y')
echo $this->loadTemplate('custom');//which is acts as blog_custom.php that I'vecreated
在类别项目的菜单管理器中,我添加页面类后缀“x”或“y”
【讨论】:
这已经是 Joomla 的核心功能。只需转到模块管理器并选择类别博客模块的任何实例,然后转到高级设置选项卡。
第一个字段 Alternate Layouts 将是该特定模块可用的所有模板覆盖的列表。
希望对您有所帮助。
【讨论】: