Well you make it seem so simple. Why go through all the fuss of templating
systems then?
The website I'm building has 5 sections, each with their own headers and
footers but all using a common main template. Then each of these sections
have their own sub pages with different content.
I realized what I really want is a main file.php to which I would add to
it's url the section name and it's content:
www.website.com/website.php?section=artists+content=intro
(I realize this isn't the proper syntax...).
So it all come sto my site haveing one main template file; 5 sub-tempaltes
for each section hesder; 5 sub-templates for each section footer and a
directory of all the content files.
It's as simple as that. So according to your last suggestion, is there an
easy way to do this? I imagine all the PHP needed for this could simply come
together in the initial website.php file from my example?
If this is a simpler solution, I'll take it. However Smarty seemed to offer
some scripting that allowed the browser to cache the templates...
-steph
www.raisinlove.com
"Well its simple, AJ. We're cool and you're not. You should just feel lucky
that we're not pounding your ass by the bike racks after school." - Marian
Try Slaughter on AJ Razor
rezinluv @ gashed.com
webmaster @ mutemag.com
webmaster @ drawnandquarterly.com
"Tyrone Slothrop" <ts@paranoids.org> wrote in message
news:fjjnhtotrg9e7t7alpi47n1a5ooic8o7b5@4ax.com...
> I presume that artists.php is a simple template of a web page and that
> the query string represents the name of the file which contains the
> content of the page.
>
> You can actually contruct the web completely from templates:
>
> <?
> require ("header.html");
> require ($QUERY_STRING . ".txt");
> require ("footer.html");
> ?>
>
> Classes and functions really have nothing to do with it. These files
> can all be simple HTML, constructed by components. Having common
> header and footer files makes life a lot easier when you have to make
> changes to a lot of pages at once.
>
> You can also drop a function which makes a query of a database into a
> page, and use the template to display the content:
>
> <?
> function get_data ($name)
> {
> $query = "SELECT * FROM table WHERE name = '$name';
> $result = mysql_query ($query);
> while ($row = mysql_fetch_array ($result))
> {
> require ("template.php");
> }
> }
> ?>
> <html>
> <body>
> <? get_data ($QUERY_STRING); ?>
> </body>
> </html>
>
> And the template.php file looks like:
> Name: <? echo $row ["name"]; ?>
> <br>
> Address: <? echo $row ["address"]; ?>
> <!-- ect. -->
>
> On Mon, 4 Jun 2001 12:16:22 -0400, "Zombie Commando [raisinlove]"
> <steph-at-raisinlove-dot-com@spam.com> wrote:
>
> >> URL would be
http://www.website.com/artists.php?artistone
> >>
> >> Call content:
> >> <?php
> >> if ($QUERY_STRING)
> >> {
> >> require ("path/to/" . $QUERY_STRING . ".txt");
> >> }
> >> ?>
> >
> >Ah, excellent...
> >But, being new to this, I'm not sure where to add this exactly. I mean
> >somewhere in my php class file, tight? Also, how to I refer to this from
the
> >artists.php page afterwards?
> >
> >Thanx!
> >
> >-steph
> >
www.raisinlove.com
> >
> >"Well its simple, AJ. We're cool and you're not. You should just feel
lucky
> >that we're not pounding your ass by the bike racks after school." -
Marian
> >Try Slaughter on AJ Razor
> >
> >rezinluv @ gashed.com
> >webmaster @ mutemag.com
> >webmaster @ drawnandquarterly.com
> >
>