/-----------------\
| Make a template |
\-----------------/
This document provides instructions on how to make your own template which is compatible with PHP-Update. Most of the page you make will be regular HTML, but it will require a few lines of PHP to be added. These are detailed below. This document is intended for those who already know HTML - if you don't, feel free to use one of the pre-defined templates!
Please note the way templates work has changed in version 2 and you will need to re-edit your template.
/-----------------\
| Headers/footers |
\-----------------/
Templates are no longer completely stored in one file. Instead, you have a header - which goes before the body text - and a footer, which comes after. These files should be named templatename_h.php for the header and templatename_f.php for the footer.
/-----------------\
| Validation |
\-----------------/
If you look at the included templates, you will notice they all start in a particular way:
echo ""; ?>
This code is required to make sure your template is XHTML-compatible - although you can change the encoding if your site is in a foreign language.
Also important are these lines, within the head area:
include "code/feedlink.php"; ?>
include "code/script_cats.php"; ?>
if($blogpost == 1) include "code/script_blog.php"; ?>
if($blogpost == 1) echo "\n";
else echo "\n"; ?>
These allow the use of "static" URLs on your site, the META tags function, Javascripts used on the site and let Firefox, Opera and other browsers know if they're on a page with an RSS feed.
/-----------------\
|Site/page titles |
\-----------------/
Firstly, in the header, make sure you have the following line of code:
echo $pagetitle; ?>
This ensures your site's title will appear in the title bar of the web browser.
Where you want the title you have entered for the specific page a user is currently visiting to appear, enter the following code:
echo $thispagetitle; ?>
/-----------------\
| Site menu |
\-----------------/
To insert the site's menu, enter the code below. Please note that if you use a graphical menu and don't use the built-in menu function, you will need to use the "back" button while using the site editor.
include "code/menucode.php"; ?>
If you wish to include a submenu, you need to put in this line:
include "code/submcode.php"; ?>
To edit the way the menu appears, go into the Setup section of the site manager.
/-----------------\
| Body text |
\-----------------/
Within the content manager, or the templates, if you want the mailing list box to appear enter:
include "code/mailer.php"; ?>
For the current poll to appear, enter:
include "code/poll.php"; ?>
If you wish to include a counter, enter:
include "code/counter.php"; ?>
And if you wish to include a contact form for visitors to e-mail you, enter:
include "code/contact.php"; ?>
For a handy dropdown box for visitors to access categories of blog postings, use:
include "code/choosecat.php"; ?>
Please note that in SQL if you wish to use mailer, poll or contact WITHIN a page, you must use the following syntax instead:
#mailer# #poll# #contact#
The other options can only be used in a template.
/-----------------\
| Switch template |
\-----------------/
You can now allow users to switch between different templates - for example, to a high contrast version of your site. To do this, insert the following line where you would like users to be able to switch:
echo "Back to regular template"; ?>
/-----------------\
| The end |
\-----------------/
This script is free software, but I do ask that you leave a link back to my site in the footer of each page so more people can find out about it. A suggested link is something like the one in the standard templates:
Powered by PHP-Update
David Bennett
August 20, 2004