$_GET loading content before head tag instead of in specified div.
- by s32ialx
NOT EDITING BELOW BUT THANKS TO SOME REALLY NICE PEOPLE I CAN'T POST AN IMAGE ANYMORE BECAUSE I HAD a 15 Rep but NOW ONLY A 5 becuase my question wasn't what they wanted help with they gave me a neg rep.
The problem is that the content loads it displays UNDER the div i placed #CONTENT# inside so the styles are being ignored and it's posting #CONTENT# outside the divs at positions 0,0 any suggestions?
Found out whats happening by using "View Source" seems that it's putting all of the #CONTENT#, content that's being loaded in front of the <head> tag.
Like this 
<doctype...>
<div class="home"> \
blah blah            #CONTENT# bot being loaded in correct specified area
</div>             /
<head>
<script src=""></script>
</head>
<body>
 <div class="header"></div>
 <div class="contents">
 #CONTENT# < where content SHOULD load
 </div>
 <div class="footer"></div>
</body>
so anyone got a fix?
OK so a better description I'll add relevant screen-shots
Whats happening is 
/* file.class.php */
    <?php
$file = new file();
class file{
    var $path = "templates/clean";
    var $ext = "tpl";
    function loadfile($filename){
  return file_get_contents($this->path . "/" . $filename . "." . $this->ext);
 }
 function setcontent($content,$newcontent,$vartoreplace='#CONTENT#'){
  $val = str_replace($vartoreplace,$newcontent,$content);
  return $val;
 }
 function p($content) {
  $v = $content;
  $v = str_replace('#CONTENT#','',$v);
  print $v;
 }
}
if(!isset($_GET['page'])){
 // if not, lets load our index page(you can change home.php to whatever you want:
 include("main.txt");
 // else $_GET['page'] was set so lets do stuff:
 } else {
 // lets first check if the file exists:
 if(file_exists($_GET['page'].'.txt')){
 // and lets include that then:
 include($_GET['page'].'.txt');
 // sorry mate, could not find it:
    } else {
  echo 'Sorry, could not find <strong>' . $_GET['page'] .'.txt</strong>';
 }
}
?>
is calling for a file_get_contents at the bottom
which I use in 
/* index.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" xml:lang="en" lang="en">
<?php
    include('classes/file.class.php');
    // load the templates
    $header = $file->loadfile('header');
    $body = $file->loadfile('body');
    $footer = $file->loadfile('footer');
    // fill body.tpl #CONTENT# slot with $content
    $body = $file->setcontent($body, $content);
    // cleanup and output the full page
    $file->p($header . $body . $footer);
?>
and loads into
/* body.tpl */
<div id="bodys">
 <div id="bodt"></div>
  <div id="bodm">
   <div id="contents">
    #CONTENT#
    </div>
   </div>
 <div id="bodb"></div>
</div>
but the issue is as follows the $content loads properly img tags etc
<h2> tags etc but CSS styling is TOTALY ignored for position width z-index etc.
and as follows here's the screen-shot
My Firefox Showing The Problem In Action
REPOSTED DUE TO PEOPLE NOT HELPING AND JUST BEING ARROGANT AND GIVING NEGATIVE VOTES and not even saying a word. DO NOT COMMENT UNLESS YOU PLAN TO HELP god I'm a beginner and with you people giving me bad reviews this won't make me help you out when the chance comes.