脚本宝典收集整理的这篇文章主要介绍了php – 如何向现有的joomla 2.5组件添加新视图(以及新的菜单项类型)?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
请问有什么步骤?
UPDATE
问题(由@ValentinDespa提供):
正如我所说,我想扩展com_content并为其添加一个新视图.现在有一些观点,如单篇文章,类别博客和类别列表.
我想添加另一个名为文章标题的菜单项,因此仅显示标题但有一些参数(如列数).
当前特征不需要它.
注意
它很简单,只需从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.
然后,您可以通过提供正确的URL来访问此视图.
例如:www.example.COM/index.PHP?option = com_content& view = yourournamename& ;layout = yourlayoutoutnames.
在这里我提到视图文件夹名称必须是控制器和模型文件名我们可以用其他名称实现,但它会在你不善于joomla时为你创建问题.
您还可以在视图中添加多个布局
你的tmpl文件夹里面只是创建新文件.也不要错过放在com_contents / controller和com_contents / model文件夹中的控制器和模型
以上是脚本宝典为你收集整理的php – 如何向现有的joomla 2.5组件添加新视图(以及新的菜单项类型)?全部内容,希望文章能够帮你解决php – 如何向现有的joomla 2.5组件添加新视图(以及新的菜单项类型)?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。