1.11M Members

PHP Templated site w/ Get file content links

 
0
 

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.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 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.

<index.php>

<?php

include('classes/file.class.php');

//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);

?>

<header.tpl>

<!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">
<head>
<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="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
</head>
<body>
	<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>
							<ul>
								<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>
						   </ul>
					  </li>
						<li><a href="?page=products">Products</a>
			                <ul>
			                <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>
			                </ul>
			          </li>
						<li><a href="?page=contact">Contact</a></li>
					</ul>
				</div>
			</div>
	</div>
	<div id="headerf">
	</div>

<body.tpl>

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

<footer.tpl>

<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>
</div>
</body>
</html>
 
1
 

have you asked your friend?

 
0
 

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

 
0
 

...but i got it resolved using stack ovverflow

OK, mark as solved then?

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