Forum Moderators: coopster
Basically when you change a layout, you change one page, and all your content is saved in their own files.
I've heard about it, but I don't know how to do it, if anyone can walk me through i'd be VERY greatful!
$page = new HtmlTemplate2_group ("../templates/main_template_chambdex.inc.php"); // Create an instance.
$page->SetParameter("PAGE_TITLE", "Member Home Page");
and of course the class section
that is above "required_once"
what the calss does:
// reads in a template, sets different values, and sends it to the browser
hope I am not off track
regards
If you want to have consistent layout for all pages of your website then you need to be talking about "templates".
You can do that in a number of ways.
The easiest way probably is to write a simple php function to generate all pages.
eg. have one file "library.php"
--library.php--
// function to generate pages with a consistent layout.
function generate_page($body)
{
echo "
<html>
<head>
</head>
<body>
~~page header~~
$body
~~page footer~~
</body>
</html>
";
}
--end library.php--
--example.php--
include('library.php'); //included on top of all pages which need this layout.
$body = "<h1>Test Page</h1>";
generate_page($body);
--end example.php--
You can have any number of pages like example.php with different $body part and they will have consistent layout. To change layout you only need to change at one place that is generate_page function in library.php file.
Hope this helps.
Jaski
Maybe try this thread for a few different approaches to site templating
A dynamic site in 2 minutes [webmasterworld.com]
I tried reading your code but none of it really made sense >.< I just need to get this step out of the way, i've looked for it everywhere but no one seems to have any tutorials, maybe i should look for php templates. I mean I can get a very very basic grip on what your saying but I gotta know what goes where, like... explaining to a 5 year old.
I know no one is going to want to do that, but it'd be GREATLY appreicated.
On the Dynamic pages in 2 minutes (which i have right now) I understood this somewhat:
include $content;
in the middle. Then you just do this on every page.
$content = "pathtocontentpage.html";
include "template.php";
That makes alittle sense but I still don't know what's going on in the code, or what changes and what stays constant.
Jaski made alittle more sense with:
eg. have one file "library.php"
--library.php--
// function to generate pages with a consistent layout.
function generate_page($body)
{
echo "
<html>
<head>
</head>
<body>
~~page header~~
$body
~~page footer~~
</body>
</html>
";
}
--end library.php--
--example.php--
include('library.php'); //included on top of all pages which need this layout.
$body = "<h1>Test Page</h1>";
generate_page($body);
--end example.php--
But I still do'nt understand what's going on, what I change, what I keep, what the content is, what everything does. I can understand it I just never learned it, like I said I kinda need someone to explain it as if i'm a 5 yr old. And also like I said no one will really want to do this but I would REALLY appreciate it, and I can possible hook up a link or something from my site to yours, I just really need to learn this and understand it right now.
Thank you ^.^
I get it because it IS what I want, it's one page that has to be changed for layouts, while the content stays alone, so when I make a new layout, I change one page and all the rest is the same (content, etc). That's what i'm looking for, but I can't get a good grip on exactly what he's saying.
I think getting into more depth with Jaski's method can REALLY help, i'd greatly appreciate any help you can give ^.^
Thank You
Oh I found the edit button >.< lol.
Ok I gotta add this too... I need a template... we know that, but with that every page is alittle different... Every page has a different banner insde and a possible different footer. Right now it's setup dynamically, but to change layouts I need to change every page. Right now it looks alittle like this:
<html>
<head>
<title>Titletitle>
<META NAME="keywords" Meta tags>
<META NAME="description" Meta tags>
<link rel="stylesheet" href="/mmcss.css" type="text/css">
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000066" LINK="#000066" VLINK="#000066" ALINK="#000066">
<SCRIPT language=JavaScript src="/menu/milonic_src.js" type=text/javascript></SCRIPT>
<scriptlanguage=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/menu/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/menu/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="/menu/menu_data.js" type=text/javascript></SCRIPT>
<br>
<br>
<?php require("http://mm.mysite.com/include/4_side.php");?>
<!-- 1st Main Table -->
<td valign=top width="450">
<DIV align=center>
<TABLE cellSpacing=1 cellPadding=3 width="100%" bgColor=#000033 border=0>
<TR>
<TD width="100%" bgColor=#000066><font color=#9FCDFF><center><b>Title</b></center></font></TD></TR>
<TR>
<TD width="100%" bgcolor=#F0F7FF>
Content
</td>
</tr>
</table>
</div>
<br>
<DIV align=center>
<TABLE cellSpacing=1 cellPadding=3 width="100%" bgColor=#000033 border=0>
<TR>
<TD width="100%" bgColor=#000066><font color=#9FCDFF><center><b>Title</b></center></font></TD></TR>
<TR>
<TD width="100%" bgcolor=#F0F7FF>
Content
</td>
</tr>
</table>
</div>
<br>
<DIV align=center>
<TABLE cellSpacing=1 cellPadding=3 width="100%" bgColor=#000033 border=0>
<TR>
<TD width="100%" bgColor=#000066><font color=#9FCDFF><center><b>Title</b></center></font></TD></TR>
<TR>
<TD width="100%" bgcolor=#F0F7FF>
Content
</td>
</tr>
</table>
</div>
</td>
<?php require("http://mm.mysite.com/include/4r_side.php");?>
</td>
</tr>
</table>
<tr>
<td>
<?php require("http://mm.mysite.com/include/bottom.php");?>
</td>
</tr>
</td>
</TR>
</TABLE>
</CENTER>
</DIV>
</BODY>
</HTML>
So I have alot of php requires which most can be in the template. But the footer changes on some pages and the .css file I have flucutates according to which page your on. Somehow I have to turn this into a template taht calls up the content... I dunno how in the world that'll happen, but you guys are experts not me lol.
Thank you for any help you can provide :)
[edited by: jatar_k at 11:38 pm (utc) on July 11, 2004]
[edit reason] generalized urls and trimmed code [/edit]