I want to make a really simple template engine for my site, to make it easier to add new pages and edit other ones.
I have a template.php
file and a variable of $pageHeader
. Then in my functions.php
file I have a function called CallHeader()
with this code:
function CallHeader()
{
echo $pageHeader;
}
The problem is this does not echo the contents of $pageHeader
to the page. I have included template.php
in functions.php
using:
include("template.php");
I have also tried setting $pageHeader
to be global but nothing works. I'm trying to call this from index.php
, which has functions.php
included. If I set the CallHeader()
function like this:
function CallHeader()
{
echo "test";
}
It works, and echo's "test" to the page on index.php
Any help as to why I can't echo the contents of $pageHeader
? Thanks