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)
-   -   {php} inside template - using smarty variable (https://forum.x-cart.com/showthread.php?t=33164)

creativearc 08-09-2007 02:27 PM

{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?

inebriate 08-09-2007 04:59 PM

Re: {php} inside template - using smarty variable
 
{assign var=tocheck value=$orders[oid].login}
{php}
$chkval = $this->get_template_vars('tocheck');
checkordernumber($chkval);
{/php}

creativearc 08-09-2007 05:16 PM

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!

acidon 08-27-2013 09:47 PM

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?

cflsystems 08-27-2013 09:52 PM

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

acidon 08-28-2013 05:44 AM

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?

acidon 08-28-2013 06:14 AM

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 :) ?

cflsystems 08-28-2013 09:24 AM

Re: {php} inside template - using smarty variable
 
http://forum.x-cart.com/showthread.php?t=67302&highlight=templater.php


All times are GMT -8. The time now is 03:22 AM.

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