Echoing variables in a template
Posted: Sun Oct 16, 2011 1:36 pm
Hello,
This is really getting on my nerves
I've created a template system for a simple script that I coded, I put variables that should be echo'd within the templates, like this:
And then in the php file I did:
But it simply echo's the file content as a string... But when I do something like:
it displays the message variable! (why??)
I don't want to add <?php echo and ?> around each variable that I want to display, I've seen a lot of templates where the programmers just wrote their variables in that format "{$variable}"
I've tried file() file_get_contents() functions but nothing works
Can someone please help me??
This is really getting on my nerves
I've created a template system for a simple script that I coded, I put variables that should be echo'd within the templates, like this:
Code: Select all
<title>{$page_title}</title>
</head>
<body>
{$message}
</body>
Code: Select all
include "link_to_file.tpl";
Code: Select all
echo "This is a message: {$message}";
I don't want to add <?php echo and ?> around each variable that I want to display, I've seen a lot of templates where the programmers just wrote their variables in that format "{$variable}"
I've tried file() file_get_contents() functions but nothing works
Can someone please help me??