PHP Templated site w/ Get file content links


Ok so i have a template script my friend built for me. I'll include all file names
OK so what is not working is file_get_contents is not grabing the content (1 I don't know where the content should be placed and 2 i want it placed in a directory so that IF i change the template the area where content stays is the same.
I'm trying to get file_get_contents to load the links ?=about ?=services etc to load in to body.tpl in the contents div
please any help is apperciated.



$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 css($val,$content='',$contentvar='#CSS#') {
		if(is_array($val)) {
			$css = 'style="';
			foreach($val as $p) {
				$css .= $p . ";";
			$css .= '"';
		} else {
			$css = 'style="' . $val . '"';
		if($content!='') {
			return str_replace($contentvar,' ' . $css,$content);
		} else {
			return $css;

	function setsize($content,$width='-1',$height='-1',$border='-1'){
		$css = '';
		if($width!='-1') { $css = $css . "width=\"".$width."\""; }
		if($height!='-1') { $css = $css . "height=\"".$height."\""; }
		if($border!='-1') { $css = $css . "border=\"" . $border . "\""; }
		return str_replace('#SIZE#',' ' . $css,$content);
	function setcontent($content,$newcontent,$vartoreplace='#CONTENT#'){
		$val = str_replace($vartoreplace,$newcontent,$content);
		return $val;
	function p($content) {
		$v = $content;
		$v = str_replace('#CONTENT#','',$v);
		$v = str_replace('#SIZE#','',$v);
		print $v;
if (isset($_GET['page'])) {
	$content = $_GET['page'].'.php'; 
} else {
	$content = 'main.php';

if some one could trim that down so it JUST is the template required code and file get contents.




//load template content
$header = $file->loadfile('header');
$body = $file->loadfile('body');
$footer = $file->loadfile('footer');
//assign content to multiple variables

$file->p($header . $body . $footer);



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta name="robots" content="index,follow"/>
<meta name="distribution" content="global"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link href="templates/clean/style.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" href="templates/clean/menu_style.css" type="text/css" />
<script type="text/javascript" src=""></script>
	<div id="header">
		<div id="logo"><a href="index.php" style="height:30px;width:150px;"><img src="images/logo.png" border="0" alt=""/></a></div>
			<div id="menuo">	
				<div class="menu">
					<ul id="menu">
						<li><a href="?page=home">Home</a></li>
						<li><a href="?page=about">About Us</a></li>
						<li><a href="?page=services">Services</a>
								<li><a href="?page=instore">InStore Repairs</a></li>
								<li><a href="?page=inhome">InHome Repairs</a></li>
								<li><a href="?page=website">Website Design</a></li>
								<li><a href="?page=soon">Comming Soon.</a></li>
						<li><a href="?page=products">Products</a>
			                <li><a href="?page=pchard">Computer Hardware</a></li>
			                <li><a href="?page=monitor">Monitor's</a></li>
			                <li><a href="?page=laptop">Laptop + Netbooks</a></li>
			                <li><a href="?page=soon">Comming Soon.</a></li>
						<li><a href="?page=contact">Contact</a></li>
	<div id="headerf">


<div id="bodys">
	<div id="bodt"></div>
		<div id="bodm">
			<div id="contents">
	<div id="bodb"></div>


<div id="footer">
<div style="position:absolute; top:4px; left:4px;"><img src="images/ff.png" alt="ok"></div> <div style="position:absolute; top:4px; right:5px; color:#FFFFFF;">&copy;2010 <a href="mailto:">Company Name</a></div>

Featured Replies in this Discussion


have you asked your friend?


yes i did he is to geeked out in his own pc life he can't stop to help ya out unless ya post it in a form that he's reading and he even looks at the thread lol but i got it resolved using stack ovverflow


...but i got it resolved using stack ovverflow

OK, mark as solved then?

Question Answered as of 4 Years Ago by diafol and BzzBee
This question has already been solved: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: