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

{php} inside template - using smarty variable

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-09-2007, 02:27 PM
 
creativearc creativearc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 34
 

Default {php} inside template - using smarty variable

In the order_list.tpl file, there's a variable that I need to use to pass it to a function.

To call the variable in the template, I use: {$orders[oid].login}

I also have this in the template:

{php}
checkordernumber(*****);
{/php}


I need to somehow get the {$orders[oid].login} value into that function (where the ***** is). I know that the function works, because it runs fine with hard coded test data. Any idea on how I can accomplish this?
__________________
CreativeArc
---------------
X-Cart Pro
Version: 4.1.8
Reply With Quote
  #2  
Old 08-09-2007, 04:59 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: {php} inside template - using smarty variable

{assign var=tocheck value=$orders[oid].login}
{php}
$chkval = $this->get_template_vars('tocheck');
checkordernumber($chkval);
{/php}
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #3  
Old 08-09-2007, 05:16 PM
 
creativearc creativearc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 34
 

Thumbs up Re: {php} inside template - using smarty variable

YES! AWESOME! I wasn't sure if this was going to be possible. This made my day. Thank you VERY much!
__________________
CreativeArc
---------------
X-Cart Pro
Version: 4.1.8
Reply With Quote
  #4  
Old 08-27-2013, 09:47 PM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Re: {php} inside template - using smarty variable

I am trying to call a smarty variable in a template following your example:

Code:
{assign var=phpprice value=$minicart_total_cost} {php} $ctotal = $this->get_template_vars('phpprice'); echo $ctotal; {/php}

For some reason it doesn't work... what am I doing wrong?
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #5  
Old 08-27-2013, 09:52 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: {php} inside template - using smarty variable

4.6.x does not allow some tags and smarty functions or modifiers that are not registered with the system to be used. You can change this behavior by editing include/templater/templater.php

But {php} smarty tag is deprecated and should not be used at all anyway
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 08-28-2013, 05:44 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Re: {php} inside template - using smarty variable

Hi and thanks for the reply!

Where can I learn more about changes I need to make to include/templater/templater.php in order to register it with a system?
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #7  
Old 08-28-2013, 06:14 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Re: {php} inside template - using smarty variable

Or, alternatively, can someone please upload a templater.php from non-4.6.x so I can figure it out on my own ?
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #8  
Old 08-28-2013, 09:24 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: {php} inside template - using smarty variable

http://forum.x-cart.com/showthread.php?t=67302&highlight=templater.php
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
acidon (08-28-2013)
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 04:49 PM.

   

 
X-Cart forums © 2001-2020