Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenation string with variable in smarty

Tags:

smarty

I need in smarty template to transmit to function concatenated string constant with variable value, How can i do it?

some example code: {$obj->calledFunc('string const').$var} but . operator doesn't work

like image 943
hippout Avatar asked Jan 28 '10 16:01

hippout


People also ask

How do you concatenate strings and variables?

Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs. For string variables, concatenation occurs only at run time.

How do you concatenate variables in Java?

Using the + operator is the most common way to concatenate two strings in Java. You can provide either a variable, a number, or a String literal (which is always surrounded by double quotes). Be sure to add a space so that when the combined string is printed, its words are separated properly.

How the variable with string concatenation pattern works?

To concatenate use the + between values. To use the Variable with String Concatenation Pattern a variable is defined which stores the value of a string combined with another string or number.

What is string concatenation with example?

In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In certain formalisations of concatenation theory, also called string theory, string concatenation is a primitive notion.


1 Answers

Use the cat modifier:

{$obj->calledFunc('string const')|cat:$var}
like image 61
Deebster Avatar answered Oct 09 '22 19:10

Deebster