View Full Version : Using PHP to modify Web cards 'on-the-fly'

05 April 2005, 09:22 AM
While modifiable web-card templates are on the wish list, I looked into alternatives to change the look of my web cards.

Obviously modifying every file individually was out of the question.

A batch process (using search and replace on a text editor) would be quicker but would still mean having to run and check it every time I updated the web cards.

I have found (and implemented) another solution on my web site. It uses PHP to parse and modify the web page before it is served. (most hosting packages include PHP support, but my pages are actually running on my iMac)

This means I do not have to do anything to the original web card files created by Reunion. I can update them as often as I want and the PHP script will make the changes as each page is requested.

I have so far used it to:

* Add the missing type declaration.
* Add a meta tag to tell search engines not to cache the page.
* Add a graphic to the top of each page
* Add a link to an external css style file, so styles can be modified in one place.
* Used the css file to change the font to Arial/Helvetica
* Remove the menu from the bottom of the pages and re-insert it at the side.

All the mods are done using a simple search/replace

You can see the modified files at http://www.fitterfamily.info (as in my sig).

The original files can be seen at http://www.ukian.com/fitterfamily0/

Note that the 'front page' has been edited in Dreamweaver - I don't replace this page when I create new web cards.

If anyone is interested, I will be posting full 'how-to' details on my blog in the near future.