Noiz Pollution
Mon 22nd Dec '03, 11:02am
hi folks,
the following code works when it's just standard code outside functions but when i put it into functions it gives me a parse error on line 31 looking for either , or ; (labelled in the code), can anybody tell me where i'm going wrong? please bear in mind i'm a bit rusty and haven't even looked at php functions in monthsinclude("/home/account/public_html/dir/config.php");
$page_title = "";
function getTemplates(){
global $db_server, $db_username, $db_password, $db_die, $db_database, $db_connection, $skin, $template_header, $template_middle, $template_footer, $template_style, $template_scripts, $template_body_attrib;
$query = "SELECT * FROM `templates` WHERE `id` = '$skin'";
$result = mysql_query($query,$db_connection);
$template = mysql_fetch_array($result);
$template_header = $template[ie_header];
$template_middle = $template[ie_middle];
$template_footer = $template[ie_footer];
$template_style = $template[ie_style];
$template_scripts = $template[ie_scripts];
if($template[body_attrib] == TRUE){
$template_body_attrib = " ".$template[body_attrib];
} else {$template_body_attrib = "";}
}
function printHeaderInfo(){
global $site_name, $misc_title_divider, $page_title, $meta_keywords, $meta_description, $template_style, $template_scripts, $template_body_attrib;
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n"; while($i < 1001){echo "\n"; $i++;}
echo "<html><head><title>".$site_name.$misc_title_divider.$page_title"</title>\n"; // line 31
echo "<meta name=\"Keywords\" content=\"".$meta_keywords."\">\n<meta name=\"Description\" content=\"".$meta_description."\">\n";
echo "<style type=\"text/css\">\n<!--\n"; eval("?>".$template_style); echo "\n-->\n</style>\n";
eval("?>".$template_scripts); echo "\n</head><body"; eval("?>".$template_body_attrib); echo ">\n";
}
function printHeaderTemplate(){
global $template_header;
eval("?>".$template_header);
echo "\n";
}
function printMiddleTemplate(){
global $template_middle;
eval("?>".$template_middle);
echo "\n";
}
function printFooterTemplate(){
global $template_footer;
eval("?>".$template_footer);
echo "\n";
}
getTemplates();
printHeaderInfo();
printHeaderTemplate();if anybody can help it'd be greatly appreciated
cheers,
Robert
the following code works when it's just standard code outside functions but when i put it into functions it gives me a parse error on line 31 looking for either , or ; (labelled in the code), can anybody tell me where i'm going wrong? please bear in mind i'm a bit rusty and haven't even looked at php functions in monthsinclude("/home/account/public_html/dir/config.php");
$page_title = "";
function getTemplates(){
global $db_server, $db_username, $db_password, $db_die, $db_database, $db_connection, $skin, $template_header, $template_middle, $template_footer, $template_style, $template_scripts, $template_body_attrib;
$query = "SELECT * FROM `templates` WHERE `id` = '$skin'";
$result = mysql_query($query,$db_connection);
$template = mysql_fetch_array($result);
$template_header = $template[ie_header];
$template_middle = $template[ie_middle];
$template_footer = $template[ie_footer];
$template_style = $template[ie_style];
$template_scripts = $template[ie_scripts];
if($template[body_attrib] == TRUE){
$template_body_attrib = " ".$template[body_attrib];
} else {$template_body_attrib = "";}
}
function printHeaderInfo(){
global $site_name, $misc_title_divider, $page_title, $meta_keywords, $meta_description, $template_style, $template_scripts, $template_body_attrib;
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n"; while($i < 1001){echo "\n"; $i++;}
echo "<html><head><title>".$site_name.$misc_title_divider.$page_title"</title>\n"; // line 31
echo "<meta name=\"Keywords\" content=\"".$meta_keywords."\">\n<meta name=\"Description\" content=\"".$meta_description."\">\n";
echo "<style type=\"text/css\">\n<!--\n"; eval("?>".$template_style); echo "\n-->\n</style>\n";
eval("?>".$template_scripts); echo "\n</head><body"; eval("?>".$template_body_attrib); echo ">\n";
}
function printHeaderTemplate(){
global $template_header;
eval("?>".$template_header);
echo "\n";
}
function printMiddleTemplate(){
global $template_middle;
eval("?>".$template_middle);
echo "\n";
}
function printFooterTemplate(){
global $template_footer;
eval("?>".$template_footer);
echo "\n";
}
getTemplates();
printHeaderInfo();
printHeaderTemplate();if anybody can help it'd be greatly appreciated
cheers,
Robert