I got a problem with Smarty and constants. I got three constant especified in a file:
DEFINE('ARTICLE_COLOUR_10', 'Light green');
DEFINE('ARTICLE_COLOUR_11', 'Claret'); // Bordó
DEFINE('ARTICLE_COLOUR_12', 'Yellow');
In DB I save only the numbers (10, 11, 12) and I send those numbers through this var
$sql_query_int = mysqli_query($connectdb, "SELECT colour FROM stock WHERE product='$articleId'");
$smarty->assign('colours', $sql_query_int);
In TPL I get those numbers
{foreach from=$colours key=field item=value}
{$value.colour}<br>
{/foreach}
Now I want to get the variable ARTICLE_COLOUR_$value.colour; I tried with three different ways but I couldn't get the complete variable.
{$smarty.const.ARTICLE_COLOUR_{$value.colour}}
{$smarty.const.ARTICLE_COLOUR_$value.colour}
{$smarty.const.ARTICLE_COLOUR_value.colour}
Fatal error: Smarty error: [in C:\xampp\htdocs/templates/default/tpl\article.tpl line 10]: syntax error: $smarty.$value.colour is an invalid reference (Smarty_Compiler.class.php, line 2169) in C:\xampp\htdocs\inc\smarty\Smarty.class.php on line 1109
I will be grateful for your help with this problem and forgiveness if this question is misspelled, my English is not very advanced.
{constant("ARTICLE_COLOUR_{$value.colour}")}