X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   using php include in tpl (https://forum.x-cart.com/showthread.php?t=31610)

amcc 06-02-2007 10:53 PM

using php include in tpl
 
Is it possible to use a php include statement in a tpl to insert a html table already created elsewhere in my site? I couldn't get it to work if it is in fact possible.

PhilJ 06-03-2007 03:11 AM

Re: using php include in tpl
 
Use

Code:

{php} ... {/php}

But omit the <? and ?>

OR

http://smarty.php.net/manual/en/language.function.include.php.php

amcc 06-03-2007 08:08 PM

Re: using php include in tpl
 
Thanks. I tried this to bring in a table into head.tpl but didn't work:

{php} include ('http://www.qualityfoodproducts.com/menu.php'); {/php}

Can you tell what's wrong with it?

PhilJ 06-04-2007 01:35 AM

Re: using php include in tpl
 
Try the other method...
Code:

{include_php file='http://www.qualityfoodproducts.com/menu.php'}

Ene 06-04-2007 04:13 AM

Re: using php include in tpl
 
Also make sure that allow-url-fopen PHP option is enabled.

inebriate 06-04-2007 12:49 PM

Re: using php include in tpl
 
why are you referring to a url? (assuming the php resides on your own server)
it will cause a dns lookup slowing down the load time

just do an " include 'menu.php'; "

you may need to add "../" before the menu.php since you are calling it from a template, but i dont remember exactly

amcc 06-04-2007 08:41 PM

Re: using php include in tpl
 
I still can't get the php include to work and have to move on now. I'll just rebuild the menu in head.tpl. Cheers thanks for you help though.

robidigital 06-06-2007 08:59 AM

Re: using php include in tpl
 
I too have tried everything suggested in this topic and have had no luck. Anymore ideas?


All times are GMT -8. The time now is 01:47 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.