EchoFool Posted June 3, 2008 Share Posted June 3, 2008 I was wondering if a way to avoid output clashing with headers... would be in the main "include" file which is on all my sites... to have: layout1.php (global include file) <?php require_once("functions.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <link rel="stylesheet" type="text/css" href="/css/main2.css" /> <link rel="stylesheet" href="/css/thickbox.css" type="text/css" media="screen" /> </head> <body> <div id="top"> <div align="center"><img src="header.gif" alt="" width="327" height="98" /></div> </div> Now say i have a page like this: register.php: <?php include($_SERVER['DOCUMENT_ROOT'].'/css/layout1.php'); //this is the script above redirect_to("login.php?failed"); die; ?> Wouldn't that technically avoid the headers already started issue because the function is in an include which is "before" anything? Link to comment https://forums.phpfreaks.com/topic/108543-headers-and-output/ Share on other sites More sharing options...
Prismatic Posted June 3, 2008 Share Posted June 3, 2008 No. Link to comment https://forums.phpfreaks.com/topic/108543-headers-and-output/#findComment-556577 Share on other sites More sharing options...
whizard Posted June 3, 2008 Share Posted June 3, 2008 once you've sent something to the page, you can no longer redirect. simple as that. Link to comment https://forums.phpfreaks.com/topic/108543-headers-and-output/#findComment-556579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.