Jump to content

[Solved] Php include not showing up?


Recommended Posts

Hey all,
I have a header image and menu along with a footer image included in Prestashop with "php include" in the header.tpl and footer.tpl. All was well until today I noticed they are not being displayed anymore. Looking at the source code of the page they're not in there but looking at the .tpl files they are... I'm pretty sure I didn't change anything to cause this but now I'm at a loss as to how to get them back. Any ideas on what might be the issue here?

Turned on the error log and this is what I get:


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/hope/public_html/treatdiva/prestashop/tools/smarty/compile/%�^AB5^AB52AB14%%header.tpl.php on line 87

Warning: include(http://www.treatdiva.com/header.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/hope/public_html/treatdiva/prestashop/tools/smarty/compile/%�^AB5^AB52AB14%%header.tpl.php on line 87

Warning: include() [function.include]: Failed opening 'http://www.treatdiva.com/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hope/public_html/treatdiva/prestashop/tools/smarty/compile/%�^AB5^AB52AB14%%header.tpl.php on line 87

Now can anyone decipher this for me??

Link to comment
Share on other sites

Include is not meant to be used in .tpl files (as far as I know).

If you provide more information about what's in the files you are trying to include (plain html, or php stuff), we'll be able to suggest the best way to include it.

Link to comment
Share on other sites

Thanks for your reply!

I have three Includes; on top I have a header image with css/js menu, on the bottom I have a footer image with links and in the side bar I have a Twitter-style update feed.

I had these linked with absoute url's but apparently my host has disabled cross site Includes due to security issues. I changed the links to relative and now these are my errors:

Warning: include(../../../header.php) [function.include]: failed to open stream: No such file or directory in /home/hope/public_html/treatdiva/prestashop/tools/smarty/compile/%

Link to comment
Share on other sites

Maybe you have an extra ../ in there

As I mentioned above, it's not a good idea to include php files directly from a .tpl file, mainly since it's more of a hack and not the same as the rest of the prestashop framework.

You can either convert them to .tpl files and include those from within the original .tpl file, or assign their content to the .tpl file as a variable, and then just print it where you want in the .tpl file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...