I'm trying to create an OpenCart 1.5.1.3 module. The issue I'm having is with including a custom php script.
When I do this in the controller:
include('module/simple_html_dom.php');
or
include('simple_html_dom.php');
I'm presented with the following error:
Notice : Error: Could not load language module/simple_html_dom! in D:\\xampp\\htdocs\\store\\system\\library\\language.php on line 26
I suspect there's a simple explanation, but just can't work it out.
I've found a way to include the file I wanted. I'm not sure it's the proper way of doing this but I used the following code - with OpenCart having such little documentation it's not easy to debug and/or develop for it.
require_once(DIR_SYSTEM . 'simple_html_dom.php');
DIR_SYSTEM is OpenCart's /system folder, so I placed my simple_html_dom.php file in there and voila, it worked.
原因是理论上您仍然从index.php文件进行调用,因此需要使用该路径的相对路径,或者使用定义的变量,您可以在config.php文件中找到所有相关的变量OpenCart使用的路径
I have the same problem in opencart. i have to install file i have something like
<?php include 'i_header.tpl';?>
I replace it with
<?php include (DIR_TEMPLATE. '/module/---your module name ---/i_header.tpl');?>
and it works. You can chose the correct path name which under the config file.
ROOT/config.php
ROOT/admin/config.php
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.