I am writing a very lightweight theme system for a set of scripts I am working on. For the most part these scripts will become diagnostic and support scripts for my other projects. Because of this, I do not want to use any database calls or such in them.
In the theme file, aptly named "theme.php", I have the following variables defined as an array:
$ss_theme["doctype"] = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
$ss_theme["css"] = "\"\"";
$ss_theme["background"] = "\"#999999\"";
$ss_theme["text"] = "\"#000000\"";
$ss_theme["link"] = "\"#009933\"";
$ss_theme["alink"] = "\"#999933\"";
$ss_theme["vlink"] = "\"#990033\"";
$ss_theme["bgimage"] = "\"\"";
$ss_theme["leftmargin"] = "\"0\"";
$ss_theme["topmargin"] = "\"0\"";
$ss_theme["bgproperties"] = "\"fixed\"";
$ss_theme["t_bordercolor"] = "\"\"";
$ss_theme["t_bordercolorlight"] = "\"\"";
$ss_theme["t_bordercolordark"] = "\"\"";
$ss_theme["t_row1"] = "\"#333333\"";
$ss_theme["t_row2"] = "\"#666666\"";
$ss_theme["t_row3"] = "\"#FFFFFF\"";
$ss_theme["warn"] = "\"#990033\"";
$ss_theme["caution"] = "\"#999933\"";
$ss_theme["okay"] = "\"#009933\"";
Then I have the following HTML shortcuts defined, again as an array:
$ss_page["start"] = $ss_theme["doctype"] ."\n<HTML>\n<HEAD>\n";
$ss_page["reply"] = "<META HTTP-EQUIV=\"Reply-to\" CONTENT=\"" .$ss_script["email"] ."\[".$ss_script["author"]."\]\">\n";
$ss_page["author"] = "<META NAME=\"Author\" CONTENT=\"" .$ss_script_author ."\">\n";
$ss_page["title"] = "<TITLE>" .$ss_info["title"] ." :: " .$ss_script["title"] ."</TITLE>\n";
$ss_page["body"] = "</HEAD>\n<BODY BGCOLOR=".$ss_theme["background"] ." TEXT=".$ss_theme["text"] ." LINK=".$ss_theme["link"] ." ALINK=".$ss_theme["alink"] ." VLINK=".$ss_theme["vlink"] ." BACKGROUND=".$ss_theme["bgimage"] ." LEFTMARGIN=".ss_theme["leftmargin"] ." TOPMARGIN=".ss_theme["topmargin"] ." BGPROPERTIES=".$ss_theme{"bgproperties"] .">\n";
$ss_page["end"] = "</BODY>\n</HTML>\n"
I have gone over the code as much as my eyes will stand at the moment, and I still cannot figure out the mistake that is causing the file to parse incorrectly when it is included into my scripts. This is the line that shows as being in error according to the parser:
$ss_page["body"] = "</HEAD>\n<BODY BGCOLOR=".$ss_theme["background"] ." TEXT=".$ss_theme["text"] ." LINK=".$ss_theme["link"] ." ALINK=".$ss_theme["alink"] ." VLINK=".$ss_theme["vlink"] ." BACKGROUND=".$ss_theme["bgimage"] ." LEFTMARGIN=".ss_theme["leftmargin"] ." TOPMARGIN=".ss_theme["topmargin"] ." BGPROPERTIES=".$ss_theme{"bgproperties"] .">\n";
I have tried so many different variants of it, it is not funny any more. If I leave the line as is, the check routine will show all variables EXCEPT for those that are part of the theme.php file, and gives me a parse error, yet displays the rest of the variables in the script and its included files. I have tried calling the theme.php file via both include_once, and require_once, neither makes a difference. If I comment the line out, everything works fine, it even prints the variables from the theme.php file as it is supposed to do at the moment. Does anyone have any thoughts of what I have done wrong?
All the line is supposed to do, is to generate two basic HTML tags, one per line when out put. Those two tags should end up looking like:
</HEAD>
<BODY BGCOLOR="#999999" TEXT="#000000" LINK="#009933" ALINK="#999933" VLINK="#990033" BACKGROUND="" LEFTMARGIN="0" TOPMARGIN="0" BGPROPERTIES="fxed">
Quite simple looking, but a pain to code... I would appreciate any help that someone can offer...