脚本宝典收集整理的这篇文章主要介绍了opencart php自定义页面,而不使用“信息”功能,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道我可以在信息部分使用管理区域放置一个自定义页面,但是我想要的是一个指向其他几个页面的控制器.
在codeignITer中,您将创建一个控制器和一个视图,如果需要,在路由文件中设置一些规则,但是我看不到这样的内容.
有人会解释或指出一些关于如何做的说明.
谢谢
Class ControllerCommonHome extends Controller
这可以使用index.PHP?route = common / home访问,并访问index()方法.如果要调用其他方法,例如foo,则需要将方法定义为
public function foo() { // Code here }
并且会使用index.PHP?route = common / home / foo来调用它
至于渲染视图,那有点棘手.基本上,您需要将所有这些添加到控制器方法的末尾
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/new_template_file.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/new_template_file.tpl'; } else { $this->template = 'default/template/common/new_template_file.tpl'; } $this->children = array( 'common/column_left','common/column_right','common/content_top','common/content_bottom','common/footer','common/header' ); $this->response->setOutput($this->render());
这将呈现/cataLOG/view/theme/your-theme-name/template/common/new_template_file.tpl
如果该文件不存在,它将尝试在默认主题文件夹中使用相同的路径
我建议你看一下几个控制器和模板,让你的头脑在哪里都可以正常进行,但这是基本的工作原理
以上是脚本宝典为你收集整理的opencart php自定义页面,而不使用“信息”功能全部内容,希望文章能够帮你解决opencart php自定义页面,而不使用“信息”功能所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。