注意:错误:无法加载语言模块/ magnorcms!在第39行的//system/library/language.php中

时间:2015-06-14 07:29:24

标签: php opencart

我已经安装了一个opencart主题,你可以在这里观看:

taswikdz.com

但标题中有错误

  

注意:错误:无法加载语言模块/ magnorcms!在第39行的//system/library/language.php中

文件在这里:

模块/ magnorcms.php

<?php  
class ControllerModulemagnorcms extends Controller {
    protected function index($setting) {
        $this->language->load('module/magnorcms');

        $this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));

        $get_lan_id = $this->config->get('config_language_id');


        $this->data['magnorcms_header'] = html_entity_decode(isset($setting['headertitle'][$get_lan_id]) ? $setting['headertitle'][$get_lan_id] : '' , ENT_QUOTES, 'UTF-8');

        $this->data['message'] = html_entity_decode(isset($setting['description'][$get_lan_id]) ? $setting['description'][$get_lan_id] : '' , ENT_QUOTES, 'UTF-8');


        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/magnorcms.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/magnorcms.tpl';
        } else {
            $this->template = 'default/template/module/magnorcms.tpl';
        }

        $this->render();
    }
}
?>

库/ language.php

<?php
class Language {
private $default = 'english';
private $directory;
private $data = array();

public function __construct($directory) {
    $this->directory = $directory;
}

public function get($key) {
    return (isset($this->data[$key]) ? $this->data[$key] : $key);
}

public function load($filename) {
    $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php';

    if (file_exists($file)) {
        $_ = array();

        require($file);

        $this->data = array_merge($this->data, $_);

        return $this->data;
    }

    $file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php';

    if (file_exists($file)) {
        $_ = array();

        require($file);

        $this->data = array_merge($this->data, $_);

        return $this->data;
    } else {
        trigger_error('Error: Could not load language ' . $filename . '!');
    //  exit();
    }
}
}
?>

1 个答案:

答案 0 :(得分:1)

在这里,您已在商店中添加自定义模块。因此,站点源中的模块缺少语言文件。在默认的OpenCart源中无法使用自定义模块语言文件。

最可能的原因可能是您在源中缺少以下文件之一:

catalog/language/your-language-folder/module/magnorcms.php

您需要添加magnorcms.php文件。然后试试。