| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:57:11 2008 ] | [ PHP-Update 2.7 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 /-----------------\ 2 | Make a template | 3 \-----------------/ 4 5 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! 6 Please note the way templates work has changed in version 2 and you will need to re-edit your template. 7 8 /-----------------\ 9 | Headers/footers | 10 \-----------------/ 11 12 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. 13 14 /-----------------\ 15 | Validation | 16 \-----------------/ 17 18 If you look at the included templates, you will notice they all start in a particular way: 19 <? echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"; ?> 20 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 21 <html xmlns="http://www.w3.org/1999/xhtml"> 22 <head> 23 24 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. 25 26 Also important are these lines, within the head area: 27 <base href="<? echo $rooturl; ?>"/> 28 <meta name="Description" content="<? echo $meta_description; ?>"/> 29 <meta name="Keywords" content="<? echo $meta_keyword; ?>"/> 30 <link rel="StyleSheet" href="code/templates/styles.css" type="text/css" media="screen"/> 31 <? include "code/feedlink.php"; ?> 32 <? include "code/script_cats.php"; ?> 33 <? if($blogpost == 1) include "code/script_blog.php"; ?> 34 </head> 35 <? if($blogpost == 1) echo "<body onload=\"number()\">\n"; 36 else echo "<body>\n"; ?> 37 38 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. 39 40 /-----------------\ 41 |Site/page titles | 42 \-----------------/ 43 44 Firstly, in the header, make sure you have the following line of code: 45 <title><? echo $pagetitle; ?></title> 46 This ensures your site's title will appear in the title bar of the web browser. 47 48 Where you want the title you have entered for the specific page a user is currently visiting to appear, enter the following code: 49 <? echo $thispagetitle; ?> 50 51 /-----------------\ 52 | Site menu | 53 \-----------------/ 54 55 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. 56 <? include "code/menucode.php"; ?> 57 58 If you wish to include a submenu, you need to put in this line: 59 <? include "code/submcode.php"; ?> 60 61 To edit the way the menu appears, go into the Setup section of the site manager. 62 63 /-----------------\ 64 | Body text | 65 \-----------------/ 66 67 Within the content manager, or the templates, if you want the mailing list box to appear enter: 68 <? include "code/mailer.php"; ?> 69 70 For the current poll to appear, enter: 71 <? include "code/poll.php"; ?> 72 73 If you wish to include a counter, enter: 74 <? include "code/counter.php"; ?> 75 76 And if you wish to include a contact form for visitors to e-mail you, enter: 77 <? include "code/contact.php"; ?> 78 79 For a handy dropdown box for visitors to access categories of blog postings, use: 80 <? include "code/choosecat.php"; ?> 81 82 Please note that in SQL if you wish to use mailer, poll or contact WITHIN a page, you must use the following syntax instead: 83 #mailer# #poll# #contact# 84 The other options can only be used in a template. 85 86 /-----------------\ 87 | Switch template | 88 \-----------------/ 89 90 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: 91 <? echo "<a href=\"index.php?s=$s&p=$p&c=$c&m=$m&t=$t&o=$o&tn=TEMPLATE_NAME_HERE\">Back to regular template</a>"; ?> 92 93 /-----------------\ 94 | The end | 95 \-----------------/ 96 97 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: 98 Powered by <a href="http://www.php-update.co.uk" target=_blank>PHP-Update</a> 99 100 David Bennett 101 August 20, 2004
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |