The environment: I am using PHP, MySQL under Windows 98 running PWS.
The background: I am generating an HTML page using PHP. I call a function in a second php file which reads an HTML template record from a table, and returns it as a string. I then do a replace in the string with the generated content, and then use print($Output) to spit the page to the browser.
The problem: Once I have retrieved the template in its string it would be sensible to hold it as a global variable so I can re-use it. At the moment the key lines are:
include("GetTemplate.php");
$Template = GetTemplate("other2");
//then in GetTemplate.php
function GetTemplate ($TemplateReq) {
....
return $Template;
}
//back in calling php
$Output = eregi_replace('{body}',$Output,$Template);
print ($Output);
What do I remove and replace with 'global ($Template);'?
Many thanks.
By the way, with a little VB experience, a couple of PHP books, and the MySQL help file, it looks like a lot is possible!
www.thelondonhouse.co.uk
Bookmarks