Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

using php include in tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-02-2007, 10:53 PM
 
amcc amcc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 73
 

Default 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.
__________________
X-Cart Pro 4.1.8
Reply With Quote
  #2  
Old 06-03-2007, 03:11 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 06-03-2007, 08:08 PM
 
amcc amcc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 73
 

Default 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?
__________________
X-Cart Pro 4.1.8
Reply With Quote
  #4  
Old 06-04-2007, 01:35 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: using php include in tpl

Try the other method...
Code:
{include_php file='http://www.qualityfoodproducts.com/menu.php'}
__________________
xcartmods.co.uk
Reply With Quote
  #5  
Old 06-04-2007, 04:13 AM
  Ene's Avatar 
Ene Ene is offline
 

X-Cart team
  
Join Date: Aug 2004
Posts: 907
 

Arrow Re: using php include in tpl

Also make sure that allow-url-fopen PHP option is enabled.
__________________
Eugene Kaznacheev,
Evangelist/Product Manager at Ecwid: http://www.ecwid.com/ (since Sept 2009)

ex-Head of X-Cart Tech Support Department
ex- X-Cart Hosting Manager - X-Cart hosting
ex-X-Cart Technical Support Engineer


Note: For the official guaranteed tech support services please turn to the Customers HelpDesk.
Reply With Quote
  #6  
Old 06-04-2007, 12:49 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default 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
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #7  
Old 06-04-2007, 08:41 PM
 
amcc amcc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 73
 

Default 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.
__________________
X-Cart Pro 4.1.8
Reply With Quote
  #8  
Old 06-06-2007, 08:59 AM
 
robidigital robidigital is offline
 

Member
  
Join Date: Aug 2004
Posts: 23
 

Default Re: using php include in tpl

I too have tried everything suggested in this topic and have had no luck. Anymore ideas?
__________________
Ryan Robillard
www.RobiDigital.com
Hagerstown, Boonsboro, Frederick, MD web site design, development and graphic design

X-Cart v4.4.2 Gold
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:05 AM.

   

 
X-Cart forums © 2001-2020