This month marks the 12th year since I hoisted my first HTML file on a web server and flicked on the switch. Since then, my master directory of web content files has something like 50 or 60 thousand documents, a sprawling metropolis of stuff.
In talking recently about our web sites, I realized in the last year, my development or addition of new project or event web sites is driven my a goal of creating fewer, not more web pages. This is largely achieved via some solid lessons and methods re-used in PHP, where an entire web site can have 1 template, an external library of functions and code bits, and sub directories of content files. I do some with database, but quite a bit is done with just arrays of data, or content plucked from text files.
This is one of the things weblogs quietly achieve for us, managing display via templates, keeping content and formatting apart, allowing massive visual design changes by swapping themes. It gets folks focusing on the conten they are creating, not the FONT tags, the color codes, or the image alignments.
For example, I never build navigation links in my sites. I have a single function, that reads an array of possible link URLs and targets, and builds the nav links on the fly, and it knows to mark the page in view in a different manner. This flexibility is key, as somewhere down the line, a program manager will wander in the office and say, “Can we add a new section to the web site on policies?” or “Can we move the link for the profiles further up the page?”.
If navigation links are hand coded across many pages, you face a lot of hand editing, or some clever search and replace. With my approach, I just need to re-order an array, or add a new array item, and I am done.
I have one master PHP include file that does the footers in hundreds of PHP pages, automatically entering the page name, the modification date, the correct URL.
I recently needed to make some updates and add new content to one of our program sites that’s been around since 1999. It was a collection of perhaps 70-80 static HTML files, not all the navigation links were the same on all pages, it was an ugly set of nested table content.. With PHP, I was able to get our Maricopa Institute for Learning site down to 6 PHP template pages, all with consistent design, move the main design out of tables into pure CSS, and toss in some more stylistic formats.
Yes, my new goal is to create fewer web pages.
A great point and something I’m trying to get our school district to go towards. We have several huge content resource sites that are over a hundred pages of static html (not even any css). They are a huge pain to update and often even worse for users in my opinion. Both those things equal less frequent updates and much less use of what is very good information.
I’m looking to pick up some mySQL/PHP skills anyway. Do you have any recommendations for tutorials or books?
By the way- for some reason I’m getting 404’s off of the package links on your http://www.mcli.dist.maricopa.edu/mil/projects.php page. I’m running Safari 2.0.2. Thought you might want to know.
First of all thanks Tom for noting an error on the MIL page– My code had a relative link built wrong, but it was one edit to fix 😉 Here is something else that I have found valuable- a web audience that is willing to let you know of things that do not work or do not make sense.
Also, one thing I left out was building re-directs for all of the old *.html files. I am really against moving/renaming web files and not leaving a redirection or even a note. So for all of the old *.html files, I used a simple format at Meta-Refresh tag:
http://www.mcli.dist.maricopa.edu/mil/projects.html
As far as learning PHP/MySQL, I am hard pressed to recommend specific resources as it really depends on your style of learning and proficiency at coding, logic, etc.
I think I had purchased a basic MySQL / PHP Intro book (the title escapes me but it was noty a thick tome). Maybe something like PHP/MySQl for the Absolute Beginner:
http://www.amazon.com/exec/obidos/tg/detail/-/1592004946
You will; find plently of online tutroials by Googling PHP mysql +tutorial
A nifty interactive site to learn the basics of writing SQL statements is http://sqlcourse.com/ and the followup http://sqlcourse2.com/ In fact, the original version of this was crfeated by a colleague here at Maricopa– a real code genius.
I also continue to pick up a lot of learning from just using the online PHP reference http://www.php.net/ as each entry has user contributed notes. And then there are tonrs of libraries of exisiting PHP code you can not only use but learn some code techniques.
And finally, it helps to have a small project you can learn as you do. I never got far with just book or tutorial examples; it always made more sense to me as I learned by doing ym own projects.
Best of luck! I’ve been doing this for about 4-5 years and still have a long way to go.
I try to teach my students that computers are good at only one thing: doing the same thing over and over. Humans are bad at that. If you find yourself doing the same thing over and over and you’re using a computer, you’re doing something wrong. I started using PHP about 10 years ago when I wrote Webliographer, a URL database.
I’m much too lazy now to write my own scripts to format stuff, but it wasn’t until I started using Drupal that I started putting stuff on the web again. I don’t understand how anyone creates static HTML pages. I’m much too lazy for that.