Use a variable inside a variable in Smarty 2 template - smarty

I am trying to use a smarty variable inside a smarty variable in a template.
The following will work in smarty 3 but not in smarty 2:
{$_content_{$id}.content_title}
to display for example:
{$_content_10.content_title}
In smarty 2 it only throws an error. Is there any way to do this in smarty 2?

Related

Using both Laravel blade and vue variables together

I am trying to use both vue and blade variables to make calculation as follow :
#{{vueNumber}} * {{$bladeNumber}}
and I would want to get result of multiplying these 2 numbers.
I have tried using vue variable inside #php and it threw error , how can this be achievable ?

Using #lang directive als default value of #yield directive in Blade/Laravel

Regarding the Laravel documentation, the #yield directive in a blade template can have a default value as second argument. Since I'm developing a multi language site, how is it possible to use the #lang directive as default value?
I've already tried:
#yield('title', #lang('title'))
#yield('title', lang('title'))
neither of them is working.
Use Lang::get() or trans() to get the localized version of your string:
#yield('title', trans('title'))

Laravel 4.1 Blade + Handlerbar escaping issue (%20, %7B etc ..)

I'm working with Laravel 4.1 (recently update to) and Handlebars.
I have a view where I mix Blade template and Handlebars template.
My problem is that this line:
View
return me this :
http://local/event/%7B%7Bid%7D%7D
instate of :
http://local/event/7 (if id = 7)
Note that this line return the correct value :
<span>#{{id}}</span>
The issue occurs only in the url() Laravel helper :(
Thank you in advance!
You cant get Handlebars to put the $id there - because it is a Laravel PHP function url() that must resolve first, and the result is passed to Handlebars.
i.e. this would work:
View
But you cant get Handlebars to use an ID in the Laravel function.
What you are trying to do in your example is get Laravel to pass a URL to Handlebars, Handlebars inserts the ID, then Laravel finishes the function - which wont work.
In my case the workaround is
View

How to process freemarker template from variable inside template?

Simple example:
<div>${item.content}</div>
But inside of item.content variable may exist another template code, such as
<#if otherItem.image??><div class ...>...</#if>
Is that possible to tell freemarker compile this code inside variable?
?interpret creates a directive from a string. Note that it doesn't call the directive. Expressions that evaluate to directive can be called with <#someExpression />. Putting these together you get:
<div><#item.content?interpret /></div>

smarty v3, get value from smarty

how get variable from smarty v3?
With Smarty v2 i use this function: get_template_vars, but in v3 this no't work.
They removed the underscores and went camelCase in version 3: getTemplateVars()

Resources