Это горячая тема в наши дни, и мне нужно создать шаблон на основе 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 . '!');
}
}
Теперь, когда япопытаться получить доступ с помощью Mobile User Agent. Я получаю эту ошибку:
D: \ Webserver \ htdocs \ portal / catalog / view / theme / libcommerce_mobile / Предупреждение: требуется (D: \ Webserver \ htdocs \portal \ catalog \ view \ theme \ libcommerce_mobile) [function.require]: не удалось открыть поток: в D: \ Webserver \ htdocs \ portal \ system \ engine \ controller.php отказано в строке 77 Неустранимая ошибка: require () [function.require]: Не удалось открыть обязательное 'D: \ Webserver \ htdocs \ portal / catalog / view / theme / libcommerce_mobile /' (include_path = '.; D: \ Webserver \ php \ PEAR') в D: \ Webserver \ htdocs\ portal \ system \ engine \ controller.php в строке 77
Но что удивительного в том, что каталог существует и его можно прочитать, можно помочь с этим?Что я делаю не так?Приветствия еще раз
PS: Исходя из этой темы, размещенной здесь http://forum.opencart.com/viewtopic.php?f=20&t=47124