I've seen several scripts during my time as a web programmer (I'm still new though) which had PHP included in an uncommon way.
The PHP was not added the usual way like <div><?php echo $foo; ?></div>
, but this way: <div>{FOO}</div>
or this <div>{$foo}</div>
.
I am wondering how I could achieve such a thing? I really want to learn this thing.
Can someone direct me to the correct sources to learn this?
Thanks.
It has to be a template engine? You inject values to it from a PHP script. Smarty is a basic example.
For example, from your PHP page, you write :
include('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('foo', 'Bar Baz');
$smarty->display('index.tpl');
And, your template page would look like
<div>{foo}</div>
with .tpl extenstion.
When the program is run, the template variable {foo} will be replaced by its assigned value "Bar Baz"
The Developer must have been using a Template Engine Such as Smarty
You can even define arrays:
{assign var=foo value=[1,2,3]}
Objects
{$foo->bar}
The following would help you get started