Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.inc web templates

Status
Not open for further replies.

kharddie

Instructor
Feb 7, 2006
23
AU
how come i cant creat a template with inc extention using this code or does it have to be full html and no php?when i use it nothing happens?????

<html>
<head>
<title> Page 1 </title>
<link rel="stylesheet" type="text/css" href="kenyathez.css"/>
</head>

<body>
<?php
include ("{TOPHTM}");
?>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?php
include ("TOPMIDHTM}");
?></td>
</tr>
</table>
<!-- Table for Main Body -->
<table width="81%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="111" align="right" valign="top">
<?php
include ("{MENU}");
?>
</td>
<td width="1" bgcolor="#336601" valign="top"> </td>
<td valign="top" bgcolor="#FFFFFF">

<?php
include ("{BODY}");
?>
<br>
<br></td>
</tr></table>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?php
include ("{FOOTER}");
?></td>
</tr>
</table>
</body></html>

.................................
regards
arden
 
yes it does translate to a file name ive used a similar tenplate before with only html and works fine
 
Is the file you posted the one with the .inc extension? Are .inc files setup as being parsed for .php code? If not, your php tags will simply output as regular text.
 
how do i do that Vragabond????
how do i customise this class so that the Creatpage() function or thepage that is send to the browser is processed as a php page instead of a html page because my html template(the one above) has php include codes in the tables so it has to be processed as .php ?????





<?php



class HtmlTemplate{

var $template;
var $html;
var $parameters= array();

function HtmlTemplate ($template) { //sets which template to be used

$this->template = $template;
$this->html = implode("",(file($this->template))); //read the template into an array and then creat
}



function SetParameter ($variable,$value){ //sets tha particular values

$this->parameters[$variable] = $value;
}


function CreatePage (){ //does the bulk of the work


foreach ($this->parameters as $key => $value){ //loop thro all the parameters and set the variables to values.
$template_name='{'.$key.'}';

$this->html =str_replace($template_name,$value,$this->html);
}
echo $this->html;
echo "sawa";


}
}




?>


thanks guys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top