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

Is it possible to embed php code into template files?

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-26-2016, 11:23 AM
 
Mariusz Mariusz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 55
 

Default Is it possible to embed php code into template files?

Hi all,

We've been using iframes to run external php code on our e-comm pages, but now we need more control from the page. So is it possible to embed php code into template files?
__________________
X-Cart
Version 4.5.4
Version 5.1.11
Version 5.2.15 x3
Reply With Quote
  #2  
Old 10-26-2016, 11:43 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default Re: Is it possible to embed php code into template files?

It is possible however it creates a security hole and should not be used.
The ability to do this was active by default with older versions of XC. With newer versions it is turn off by default because of security. You will need to modify the smarty script and allow for PHP tags
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 10-26-2016, 11:47 AM
 
Mariusz Mariusz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 55
 

Default Re: Is it possible to embed php code into template files?

Quote:
Originally Posted by cflsystems
It is possible however it creates a security hole and should not be used.
The ability to do this was active by default with older versions of XC. With newer versions it is turn off by default because of security. You will need to modify the smarty script and allow for PHP tags

Thanks! Could you please provide the steps?
__________________
X-Cart
Version 4.5.4
Version 5.1.11
Version 5.2.15 x3
Reply With Quote
  #4  
Old 10-26-2016, 12:22 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default Re: Is it possible to embed php code into template files?

Simple forum search and you can find the answer

https://forum.x-cart.com/showpost.php?p=360239&postcount=2

see after "If using v4.5.5+, you'll need to edit include/templater/templater.php"

Oh sorry I just saw this is for XC5? You cannot do this there. You should create custom module, do all the work in php and call function to return result in template file
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
qualiteam (10-27-2016)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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:22 PM.

   

 
X-Cart forums © 2001-2020