也许我想在内容组件中添加新的view
和新的Menu Item Type
。
请采取什么措施?
更新
问题(@ValentinDespa
):
您想要扩展com_content功能,或者想要覆盖a 查看或构建一个可以执行某项操作的新组件?
正如我所说,我想扩展com_content
并为其添加新视图。目前有一些观看次数,例如Single Article
,Category Blog
和Category List
。
我想添加另一个名为Article Titles
的菜单项,因此只会显示标题,但会显示一些参数(例如列数)。
当前功能不提供此需求。
注意
伙计们,我的新视图应该是什么样的,请告诉我如何创建新视图。
答案 0 :(得分:3)
是您可以创建新视图。
简单地从com_content中复制任何视图(类别,博客)。
文件结构应该与文件夹内一样。
Step 1
view.html.php
tmpl
your layout names(default.php)
xml file.
Also remember to change the class name of the view.html.php
Step 2
Add a controller file (just make a copy of existing one category or blog)
Controller name must be your new view folder name.
Also remember to change the class name of the controller
step 3
add a model file for your new view (same make copy of any existing)
remember to change the class name and file name should be view folder name.
然后您可以通过提供正确的网址来访问此视图。 例如:www.example.com/index.php?option = com_content& view = yourournamename&amp ;layout = yourlayoutoutnames。
这里我提到的视图文件夹名称必须是我们可以用其他名称实现的控制器和模型文件名,但是当你不善于joomla时它会给你带来问题。
注意: 要添加视图,您不需要安装组件,这根本不是一个好主意。
您还可以在视图中添加多个布局 你的tmpl文件夹里面只是创建新文件。也不要错过放在com_contents / controller和com_contents / model文件夹中的控制器和模型
获取更多帮助take a look at this