dr.pepper Posted July 4, 2012 Share Posted July 4, 2012 (edited) Hi I'm trying to concat a string with the value of a variable, something like this: $a = 'string ' . $v; How can I do this in a .tpl file? Thanks in advance. Edit: While I can't get to work it directly in a .tpl file, I had to declare the variable in the controller, like this 'silly' example: ExampleController.php ----------------------------- $b='hello'; self::$smarty->assign('c', $b.' joe'); your.tpl ---------- Value of c: {$c} Side notes: When I tried to 'create' a variable directly in a .tpl file, for example: {$name = 'Joe'} Your name {$name} worked ok in local mode but not when uploaded it to a server. So I must to declare it like: {assign var = name value= 'Joe'} Your name {$Joe} --------------------- But to resume, with my novice skills I was trying to create variables in .tpl files instead on a controller. bellini13, I didn't notice I had to select Full Edit mode to edit the title, many thanks. Edited July 4, 2012 by dr.pepper (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted July 4, 2012 Share Posted July 4, 2012 just edit the topic and put solved in the subject line. also, its common practice to provide the solution that fixed your problem. you did request help from the community, you might as well contribute Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now