Ett trevligt system gjort av Philip Olson.
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">Kod:<font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#006666">
It's very easy to run a template driven website with php. This includes two files:
-----------------------------------------------------------------------------
Desciption of : mysite_web.inc :
-----------------------------------------------------------------------------
This "Controls" your entire website :
- metatags
- CSS
- header
- footer
- various settings that you define (default table width, background colors, etc.)
- and more
NO database is needed although you of course could implement one.
-----------------------------------------------------------------------------
Description of : template.php :
-----------------------------------------------------------------------------
This is an example on how to use mysite_web.inc . You'll see it's quite easy
to use. Replicate this page, rename and be happy.
If you find this useful or make improvements, please email me (philip@theprojects.org).
This is cut-n-paste ready and should not give you any problems, very simple actually.
If there's something you don't understand, use the forums here and/or email me and
you will receive explanation and hopefully I'll include it in the "documentation."
FYI, My name is Philip Olson and you may visit my little home at theprojects.org .
You may if you wish give me credit if you use this but that is NOT at all required.
You can copy , burn, eat and use this code all you want. Don't copy and call it
your own though or you'll gain bad Karma.
-----------------------------
file: mysite_web.inc
-----------------------------
<?
function my_siteTop (
# these variables are the default of all your pages
# made with this template but each page can be
# configured very easily, see below.
$title= "default title",
$description= "default description of webpages goes here",
$keywords= "keywords,here,and,here,too",
$author= "Philip Olson",
$color_body= "ffffff",
$color_sidebar= "#FFFFCC",
$color_table= "cccc99",
$color_link= "666633",
$color_vlink= "663366",
$color_hover= "ffffff",
$color_text= "000000",
$width= "640"
) {
?>
<!-- everything below this goes on all pages controlled by this super-duper
inc file. -->
<html>
<HEAD>
<TITLE> <? echo $title; ?></TITLE>
<META NAME="description" CONTENT=" <? echo $description; ?>">
<META NAME="keywords" CONTENT=" <? echo $keywords; ?>">
<META NAME="author" CONTENT=" <? echo $author; ?>">
</HEAD>
<!-- this is just a CSS which of course is not required -->
<STYLE TYPE="text/css">
<!--
TD,P,DL,LI,UL {
font-size: 10pt;
}
TD,DL,LI,UL,h1,h2,h3,h4,h5 {
font-family: helvetica, arial, tahoma;
color: #000000
}
h3 {
font-weight: bold;
font-size: 12pt;
color: #000000
}
tt {
font-weight: bold;
font-size: 8pt;
color: #000000
}
A {
font-weight: bold;
text-decoration: none;
color: #666633
}
a:hover {
color: #000000
}
-->
</STYLE>
<body
bgcolor="<? echo $color_body; ?>" .
text="<? echo $color_text; ?>"
link="<? echo $color_link; ?>"
vlink="<? echo $color_vlink; ?>">
<table bgcolor="#FFFFFF" cellspacing="2" cellpadding="2" border="0" width=<? echo $width ?>>
<tr>
<td>[ nav ] [ bar ] [ here ] [ perhaps ] [ yeah ] [ maybe ]</td>
</tr>
<tr>
<td>
<?
}
function my_siteBottom () {
?>
<!-- everything below this goes in the footer when you call
the fs_websiteBottom function, as done in the template. -->
</td>
</tr>
<tr>
<td>Copyright © 2000 <? echo $title ?>, all rights reserved.
Last Modified :
<?php
putenv("PHP_TZ=America/Los_Angeles");
echo date( "F d, Y.", getlastmod() );
?></font></td>
</tr>
</table>
</body>
</html>
<?
}
?>
-----------------------------
file: template.php
-----------------------------
<?
include "my_site.inc";
my_siteTop ("i am the title of this page","description of this page","key,words,here");
?>
<h3>Hi</h3>
<p>this is a template. I am one of a million pages
that is controlled by fs_website.inc . change one
and you change us all.</p>
<pre>
<p>Important Notes :</p>
- you define your metatags per page. if you don't want to define them
and use the default ones as per mysite_web.inc , do this :
Change :
fs_websiteTop ("i am the title of this page","description of this page","key,words,here");
To :
fs_websiteTop ();
Each page that you do this to will use the default meta tags.
</pre>
<?
my_siteBottom ();
?>
------------------
webmaster resources
[Redigerat av Matti den 12 feb 2001]