这是一个热门话题,我需要为我的网站构建一个基于jQuery Mobile的模板。构建模板不是问题,而是显示有人通过移动设备导航时的问题。我知道我需要在OC核心中更改一些代码才能做到这一点,但需要一些建议或帮助。首先,模板加载的地方是/system/engine/controller.php。这是函数:移动设备开发
protected function render() {
foreach ($this->children as $child) {
$this -> data[basename($child)] = $this -> getChild($child);
}
if (file_exists(DIR_TEMPLATE . $this -> template)) {
extract($this -> data);
ob_start();
require (DIR_TEMPLATE . $this -> template);
$this -> output = ob_get_contents();
ob_end_clean();
return $this -> output;
} else {
exit('Error: Could not load template ' . DIR_TEMPLATE . $this -> template . '!');
}
}
好吧,我管理如何应对检查,如果用户代理是移动设备或没有,这是结果:
protected function render() {
foreach ($this->children as $child) {
$this -> data[basename($child)] = $this -> getChild($child);
}
//--------- ADDED -------------------------------------------------
if ($this -> config -> get('mobile_status') == 1) {
if (($this -> isMobile() && $this -> config -> get('autodetect') == 'true') || $this -> session -> data['ismobile'] == 1) {
$mobile_template = $this -> config -> get('mobile_template_name');
if ($mobile_template != '') {
if (!function_exists('is_dir') || (function_exists('is_dir') && is_dir(DIR_TEMPLATE . $mobile_template))) {
$this -> template = $mobile_template . "/";
}
}
}
}
//--------- ADDED -------------------------------------------------
if (file_exists(DIR_TEMPLATE . $this -> template)) {
extract($this -> data);
ob_start();
require (DIR_TEMPLATE . $this -> template);
$this -> output = ob_get_contents();
ob_end_clean();
return $this -> output;
} else {
exit('Error: Could not load template ' . DIR_TEMPLATE . $this -> template . '!');
}
}
现在,当我尝试使用进入电影一个移动用户代理我得到这个错误:
D:\Webserver\htdocs\portal/catalog/view/theme/libcommerce_mobile/Warning: require(D:\Webserver\htdocs\portal\catalog\view\theme\libcommerce_mobile) [function.require]: failed to open stream: Permission denied in D:\Webserver\htdocs\portal\system\engine\controller.php on line 77 Fatal error: require() [function.require]: Failed opening required 'D:\Webserver\htdocs\portal/catalog/view/theme/libcommerce_mobile/' (include_path='.;D:\Webserver\php\PEAR') in D:\Webserver\htdocs\portal\system\engine\controller.php on line 77
但令人惊讶的目录存在,它的可读性,对此的任何帮助?我做错了什么? 干杯一次
PS:从这个主题来这里http://forum.opencart.com/viewtopic.php?f=20&t=47124
是'libcommerce_mobile'目录或文件? –
是一个默认目录的副本,仅用于测试目的,后来我修改了适合移动版本的内容 – ReynierPM