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)
-   -   Smarty variable indexed by string question (https://forum.x-cart.com/showthread.php?t=68182)

DavyMac 11-19-2013 07:05 AM

Smarty variable indexed by string question
 
This is a problem with understanding how smarty works:

I have a variable array $banner_code where $banner_code.$pos returns a string "x_marks_the_spot".

This string is then used to identify a variable set in php called $x_marks_the_spot.

My question is given only $banner_code.$pos how do I write to the contents of $x_marks_the_spot?

**** If only I could code this: {$"{$banner_code.$pos}"="xyz"}

carpeperdiem 11-19-2013 08:40 AM

Re: Smarty variable indexed by string question
 
{assign var="x_marks_the_spot" value=$banner_code.$pos}

$x_marks_the_spot can now be used in the template.

Yes?

DavyMac 11-19-2013 12:03 PM

Re: Smarty variable indexed by string question
 
Quote:

Originally Posted by carpeperdiem
Yes?

No! :(

I actually need to be able to write {${$banner_code.$pos}} but nested '{' are only allowed in smarty 3: example


It would appear the only way I can achieve what I am looking for is to include a php block or call a smarty pluggin, which I'm not going to do.

Thanks David


All times are GMT -8. The time now is 03:28 PM.

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