University of Nottingham

Web forum

Search suspended 

Web forum  >  Resources  >  Managing page content efficiently


Managing Page Content Efficiently

Download this page as a Word file (268kB)

A number of methods are available to help you keep your maintenance time to a minimum whilst keeping your site content dynamic. You can to separate the web site management tasks from the content updating tasks by including text files in your web pages that are maintained elsewhere. You can take advantage of free news services to provide up-to-date content or you can plan ahead and programme a timed release of info on your site.

Separating web site management from content updating

Why do it?

Separating the job of site design (your task) from the updating of information has a number of advantages:

  • those closest to the info gain a sense of responsibility and ownership for what is essentially a shared site;
  • you are relieved from the task of making simple text changes as and when other people request them;
  • there is less danger of mis-editing etc. that can happen when others are working on the whole web page.

How to do it?

  1. Write the web page as normal, but without the changing content. Save the file with a .phtml or a .php filename extension
  2. Write the changing content in another file. Save the file with a .inc extension.
  3. Insert the following php command into the page where you want the other file to show:
    <?php include "/home/username/path/filename.inc" ?>
    (replace /home/username/path/filename.inc with the path to your included file)
  4. Publish your page to the web server, and ask whoever is editing the text file to publish it to their part of the web server.

Illustration of how one web page is made up of two files - one included within the other

What else can php do?

"PHP is a server-side, HTML-embedded, cross-platform scripting language" (Webmaster in a Nutshell p309). You can write scripts in php and include them within HTML code in your phtml file. When a user requests the file the script runs and the output (the HTML and the results of your script) are served to the user. The user only sees the result of the script, never the script itself. The web team are using php to build interfaces between web pages and databases such as the Prospectus and the Events database.

Some easier to implement uses might be:

Including files in your web pages
You could include a standard header and/or footer in your pages by using php's include statement as shown over the page. For those who don't use Dreameaver, this is an alternative to using Dreamweaver templates.

Automatically updating your "page last updated" statement
You can get php to print out the date on which the file was last uploaded to the server - i.e. the date you last changed it. You can specify how that date is formatted too.

Explanation of the components of a php statement to automatically include the date on which your pages were last updated

Displaying information only under certain circumstances

 

<?php
if (condition 1) {
print "phone Jane on ext. 52145";
} else {
print "phone David on ext. 52146";
}
?>

This script checks whether a particular condition is met and, if so, carries out the first command. If not, the second command is carried out instead. This could be useful for outputting information based on certain dates etc.

 

Further resources

PHP resources
Introductory tutorial
A short introductory tutorial from php.net to give you a flavour of PHP
PHP Builder
A comprehensive site with getting started help, discussions and shared code archives.
PHP manual
PHP manual including a language reference (syntax, variables etc.), features and a function reference.
PHP info from IS

The web team have put together some introductory information and links to resources.

Whitehead, Paul (2001) PHP: Your Visual Blueprint for Creating Open Source, Server Side Content. Hungry Minds Inc
- this book has very clearly laid out uses of php, rather than being a book about how to write scripts from square 1.
Spainhour, S & Eckstein, R (1999) Webmaster in a Nutshell (2nd ed.)
- this must-have reference has a section on php as well as good summaries of HTML, Javascript, web server details etc.

Free content providers
BBC
A news ticker covering various subjects is available to include on your web site.
Moreover.com
An easy to set up newsfeed service that allows a keyword search for news items.
The Guardian Headline Service
Include Guardian news stories on your pages for free (requires registration)
QuickWebDev
all sorts of help for web developers including a listing of free news content providers and new ticker providers.
FreeSticky
free content of all sorts (quizzes, quotes, jokes, tips etc)