get smarty array value in php {php}

Go To


here is my dilemma I have 2 variables, 1 is an array and one is not. {$variable1} value is "hello"; {sp} value is a multi dimensional array. I use

{php}$xid = $smart->get_template_vars('variable1');{/php}

to assign the variable $xid the value hello. however when I use the same code :

{php}$sparray = $smart->get_template_vars('sp');{/php}

this breaks the code. so the page doesn't load. any suggestions ? p.s: I am trying to get the value of {sp.options.colors} inside the {php} tags

if I use {sp.options.colors} it returns "red" for example. anyway I can get the value inside php ?

2012-04-04 00:42
by cppit
YOU ARE THE 210,000th PERSON TO TAG A QUESTION WITH PHP! CONGRATS - savinger 2012-04-04 00:43


I figured it out : in smarty use $sparray = $this->get_template_vars('sp'); and in php put: $sparray[options][colors];

2012-04-04 01:16
by cppit