So on my website I have the pages load by first doing all of the updating and putting all the text and whatnot that I want to display. I also include a file called common.php which has all of the site functions and variables and database connections etc etc. One of the functions is called Layout(). The code for it looks like...
function Layout($content) {
global $SITE_ROOT;
include_once($SITE_ROOT . "layout.php");
}
I use it to display the layout of the site and the variable $content has all of the text to display. The layout.php has the line
global $content;
echo $content;
Which displays the text most of the time, until I ran into this problem.
I built a new functions last night called message which will display a message and stop the rest of the code from displaying or continuing. Currently the message function looks like...
function message($message, $title="", $die=0, $redirect="") {
$content = "
<center><br><br>
<table cellspacing=\"0\" cellpadding=\"2\" width=\"75%\" border=\"0\">
<tr>
<td style=\"text-align: center\">" . $title . "</td>
</tr>
<tr>
<td style=\"text-align: center\">" . $message . "</td>
</tr>
</table>
";
if (!empty($redirect)) $content .= "<meta http-equiv=\"refresh\" content=\"3;url=$redirect\">";
if ($die == 0) Layout($content);
}
Now to test this code I have this code on another page
include_once("/home/josh/public_html/bb/common.php");
message("Hello World...","Test");
Now the layout will appear, but the message will not and I can not figure out why. I know it has something to do with the Layout function but that is all I can find out.