Smarty concatinate variables

Hello all,

I need a lttle advice re: joining two string variables together in a .tpl file.

Ive tried everything and researched on the googles… but advice so far has all failed to work.

Example I just want to join two variables together with a space in between …

Eg.

variable1 = “one”

variable2 = “two”

{assign var=“variable3” value=“$one plus $two”}



Ive tried:

{assign var=“variable3” value=$one $two}

{assign var=“variable3” value=$one’ '$two}

etc nothing works, If I use anything other than just … value=$one} the page load crashes!



Could someone please advise me on the correct syntax in cs-cart tpl files .

Help greatly appreciated.

[quote name='remoteone' timestamp='1316826896' post='122194']

Hello all,

I need a lttle advice re: joining two string variables together in a .tpl file.

Ive tried everything and researched on the googles… but advice so far has all failed to work.

Example I just want to join two variables together with a space in between …

Eg.

variable1 = “one”

variable2 = “two”

{assign var=“variable3” value=“$one plus $two”}



Ive tried everything:

{assign var=“variable3” value=$one plus $two}

{assign var=“variable3” value=$one' plus '$two}

etc etc etc nothing works, If I use anything other than just … value=$one} the page load crashes!



Could someone please advise me on the correct syntax in cs-cart tpl files .

Help greatly appreciated.

[/quote]



{assign var=variable value=“$one $two”}



notice the ` around the variables.

[quote name='solesurvivor' timestamp='1316839291' post='122205']

{assign var=variable value=“$one $two”}

[/quote]

Thanks for the fast reply. Yes that worked



Ive just realised my mistake, I was using the ' character instead of the ` character.

A trap for new players I guess…

Cheers

Although reluctant to post php/smarty coding questions on the cs-cart forum, I just havent found any answers in the google kingdom, so since it applies directly to my cs-cart problem, here goes another smart(y) question…



Whats the difference between $variable and !$variable ?

ie Does

{if $lang.variable} mean “if $lang.variable is defined”

and conversely

{if !$lang.variable} mean “if $lang.variable is NOT defined”

?

Cheers

[quote name='remoteone' timestamp='1316941318' post='122250']

Although reluctant to post php/smarty coding questions on the cs-cart forum, I just havent found any answers in the google kingdom, so since it applies directly to my cs-cart problem, here goes another smart(y) question…



Whats the difference between $variable and !$variable ?

ie Does

{if $lang.variable} mean “if $lang.variable is defined”

and conversely

{if !$lang.variable} mean “if $lang.variable is NOT defined”

?

Cheers

[/quote]



Basically yes. See Smarty documentation {if},{elseif},{else} | Smarty

[quote name='Triplets' timestamp='1316954989' post='122255']

Basically yes. See Smarty documentation {if},{elseif},{else} | Smarty

[/quote]

Thanks, I had gleaned a hint from that smarty doc, but it doesnt really spell it out… Tried searching for “!$” with no results.

Thanks again.