Take the 2-minute tour ×

Im trying to

    {$mouseOver = "test"}
    {$mouseOver .= " continue"}

Like i can do this in simple php:

$test = "Hello";
$test .= " continue";

echo $test; // will output: Hello continue

In Smarty PHP template. How can i do it right?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

v2p is on the right track, but specifically you would do it like this:

{assign var="varname" value="Hello"}
{assign var="varname" value="{$varname} World"}


This would print "Hello World", and $varname would continue to hold that value until further modified.

share|improve this answer

Try {assign var='name' value='some value'}

See http://www.smarty.net/docsv2/en/language.custom.functions.tpl#language.function.assign

What about string concatenation, use cat modifier

See http://www.smarty.net/docsv2/en/language.modifier.cat

share|improve this answer

Your Answer


