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.
The reason is that you're still in theory calling from the index.php file, so need to either use a relative path from that, or use a defined variable, which you can find in the config.php file that have all the relevant paths OpenCart uses
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.
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.