I am trying to the the value of a HTML tag to a PHP variable. The code I have below will not work, the value of {mytag} is 21.
I have {mytag} as an HTML hook inside the smarty template to extract a field from a db, so I have to have {mytag}.
The plan is to use the int from the db inside some maths but as {mytag} is treated as an object I have to get the value into another variable.
$t = new stdClass;
$t->bat = "{mytag}";
$bar = $t->foo;
ob_start();
$b = var_export($bar, true);
echo $b;
$stdClass = ob_get_contents();
ob_end_clean();
$the_var = $stdClass;
When I check the output I get the name but not the value.
echo $the_var[0]
//prints ' and not 2
echo $the_var[1]
//prints { and not 1
How can I get $the_var to contain value 21?
Quite a small solution but should work.
From smarty docs: