Jump to content

Concat values in tpl [SOLVED]


dr.pepper

Recommended Posts

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 by dr.pepper (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...