I've created a simple two-part template system. The template file, template.php and the page file, whatever.php. I'm having problems with a variable however. I'm trying to set $pageTitle... example of my coding is below:
template.php
<?
function head(){
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL=StyleSheet HREF="main.css" TYPE="text/css" MEDIA="screen">
<title><?=$pageTitle?></title>
<?
}
?>
and then file.php
<?
$pageTitle = "Hi there";
include("template.php");
head();
?>
<!--- BEGIN MODIFY --->
any text here is fine
<!--- END MODIFY --->
My question is, why doesn't $pageTitle, which i'm setting in file.php echo out in the template. It's not being set. If it's something to do with globals, how do I do it? I've tried everything.
Thanks in advance for any help.