Jump to content

Include php file from a module


Recommended Posts

Hi there, I'm writing a module and in the hookheader section I'm trying to include an external (external to the module) php file.

 

When I do the following the include works:

 

include('file.php');

include('test/file.php');

 

But when I try to include like this it doesn't work:

 

include('../file.php');

include('./../file.php');

 

The problem is that I need to include something out of the module's directory but it doesn't seem to work.

 

Runing a test.php file all 4 examples work, not sure why it doesn't work in the module.

 

Any ideas ?

Link to comment
Share on other sites

. or .. means nothing for php. The server is not in any particular directory per say.

to do a relative include do include(dirname(__FILE__).'/../whatever.php'); for example.

 

BTW, php.net is your friend, you need to master this prior to try to do some complex Prestashop's module.

 

Best,

(d)oekia

Link to comment
Share on other sites

×
×
  • Create New...