Humptydank Posted June 14, 2009 Share Posted June 14, 2009 Hi folks -- Sorry, newbie question, but I'm just not getting this. Here are two pages: http://www.sharklabpoker.com http://www.sharklabpoker.com/includetest.html Everything about them is the same -- same css, same code if you look at the source. The only difference is that the header code in includetest.html is being inserted via a php include statement. Any ideas on why this is breaking the layout? How can two pages with the same css and the same html even display differently to begin with? Any help is very much appreciated. -- Dave Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/ Share on other sites More sharing options...
.josh Posted June 14, 2009 Share Posted June 14, 2009 any errant whitespace in the include? I notice a blank line in the source of 2nd page... Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855674 Share on other sites More sharing options...
mattal999 Posted June 14, 2009 Share Posted June 14, 2009 On the include page, this is being inserted just before the <div id="header">: (Theres like a little dot here) <div id ="header"><img id="logo" src="img/logo.png"> Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855675 Share on other sites More sharing options...
Philip Posted June 14, 2009 Share Posted June 14, 2009 On the included one, there is an extra character before <div id ="header"><img id="logo" src="img/logo.png"> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855676 Share on other sites More sharing options...
roopurt18 Posted June 14, 2009 Share Posted June 14, 2009 Well the answer is obvious: They're not the same. Even looking at the source in two different Google Chrome tabs I can see that one jumps down a line and has an extra character in it. Try using WinMerge to see where the difference is; it's an open source file compare utility. Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855679 Share on other sites More sharing options...
Humptydank Posted June 14, 2009 Author Share Posted June 14, 2009 Well you're surely right -- it is inserting a period or something. Thanks for the catch, I've been staring at this too long. But now I guess the question becomes - why? The php is simply: <!-- Begin Header --> <?php include('_includes/header.html'); ?> <!-- Begin Content --> and the file it's including is: <div id ="header"><img id="logo" src="img/logo.png"> </div> <div id="menu"> <ul> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="home" class="menu_txt"><a class="menu" href="#">Home</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="about" class="menu_txt"><a class="menu" href="about/index.html">About</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="classes" class="menu_txt"><a class="menu" href="classes/index.html">Classes</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="faq" class="menu_txt"><a class="menu" href="faq/index.html">F.A.Q.</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="affiliates" class="menu_txt"><a class="menu" href="affiliates/index.html">Affiliates</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> <li id="contact" class="menu_txt"><a class="menu" href="contact/index.html">Contact Us</a></li> <li class="menu_sep"><img src="img/menu_sep.png"></li> </ul> </div> Which is just a direct cut-and-paste from the original, non-included file. Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855682 Share on other sites More sharing options...
Humptydank Posted June 14, 2009 Author Share Posted June 14, 2009 Okay, I made an additional test and pointed the include to a zero-byte dummy file, and sure enough, it inserts a period on its own. I think it's something on the server-side, unless you guys have a better idea. Again, that's very much for the help. Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855692 Share on other sites More sharing options...
PFMaBiSmAd Posted June 14, 2009 Share Posted June 14, 2009 It's probably the BOM (Byte Order Mark) characters if your file is saved as a UTF-8 encoded file. Save it as an ANSI file or a UTF-8 without the BOM. Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855696 Share on other sites More sharing options...
Humptydank Posted June 14, 2009 Author Share Posted June 14, 2009 Wow PFMaBiSmAd, that was exactly it. I re-saved my include file as ansi and the problem went away. Thanks so much -- I really, really, really appreciate it! Quote Link to comment https://forums.phpfreaks.com/topic/162150-solved-php-include-breaks-layout/#findComment-855722 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.