I'm facing an issue with assigning a variable in Smarty template engine using PHP. I have been trying to assign a value to a Smarty variable, but for some reason, it doesn't seem to be working.
Here's the code snippet where I'm trying to assign the variable:
$smarty = new Smarty;
$template_dir = 'path_to_my_templates';
$smarty->template_dir = $template_dir;
$smarty->assign("myVariable", "Hello World");
After assigning the value, I am attempting to use the `myVariable` in my Smarty template, but it appears to be empty:
When I view the output, the `h1` tag is empty. I have checked that the template file paths are correct, and I am able to load and display the template without any issues. However, the assigned variable doesn't seem to pass the value.
Am I missing something here? Is there a specific syntax or step that needs to be followed in order to assign a Smarty variable correctly? Any help or suggestions would be greatly appreciated!