{{thumb}} into PHP variable

I try to insert inside HTML the following src element:

<img class="ms-thumb" src="{{thumb}}" alt="{{title}}"/>             

But when I upload to Smarty design framework it is an error. Maybe I can achieve this using PHP and assign variable. How to add {{thumb}} into PHP variable in this case as I will assign it to a variable.

$img_thumb = "thumb";
$smarty->assign('img_thumb','img_thumb');

Need help.

shouldnt that be assign('thumb','somevalue')?

It is the correct

$smarty->assign('img_thumb','img_thumb');

But a problem arise how to manage variable value:

$img_thumb = "{{thumb}}";

without PHP error.

How is the code supposed to relate the img_thumb to be used for thumb in the template?

If you use thumb in the template then that is what you should assign.

I thought it is a reserved character in PHP :

{{thumb}

It works inside HTML.
You are right as it is missing $. I made typo mistake.

$smarty->assign('img_thumb','$img_thumb');

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.