pcw Posted March 11, 2009 Share Posted March 11, 2009 Hi, I am trying to use this page as a header function for my script, but when I try to call the function in another file, I get this error: Fatal error: Cannot redeclare header() in /home/public_html/templates/admin/header.php on line 42 This is the code for header.php <?php function header() { print <<<HEADER <html> <head> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 24px; } .style2 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; } .style3 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 14px; .style4 {color: #FFFFFF} .style6 {color: #FFFFFF; font-weight: bold; } .style7 {color: #FFFFCC} } --> </style> </head> <body bgcolor="#14285f"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="02021e"> <td height="58" nowrap="nowrap" colspan="3" id="logo" valign="bottom"><div align="center" class="style1">MySite </div></td> </tr> <tr bgcolor="02021E"> <td height="57" nowrap="nowrap" colspan="3" id="tagline" valign="top"><div align="center" class="style2">Test Page</div></td> </tr> </table> <br> HEADER; } ?> How do I fix this? I just want to use headers and footers as a function, as it is quicker and tidier than typing it all out. Link to comment https://forums.phpfreaks.com/topic/148928-solved-header-error/ Share on other sites More sharing options...
rhodesa Posted March 11, 2009 Share Posted March 11, 2009 header() is already a PHP function...name the function something else...maybe doHeader() Link to comment https://forums.phpfreaks.com/topic/148928-solved-header-error/#findComment-781984 Share on other sites More sharing options...
pcw Posted March 11, 2009 Author Share Posted March 11, 2009 Thank you, it worked! Link to comment https://forums.phpfreaks.com/topic/148928-solved-header-error/#findComment-781994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.