Bitesize HTML5 – Switch from HTML to PHP Coding

with No Comments

The Artajo’s Cafe code that Ranz Artajo (one of my students) sent to me, has now been validated at W3C for XHTML and CSS3.  You can view both the original code and the improved code at http://artajocafe.a143.net/

Marie Pelin did a great job of validating and correcting the little site.  The corrected site has links on the footer to the XHTML and CSS3 tests.

It is on my list to convert the XHTML to HTML5 at this time.  However, I noticed it would be far easier to change to PHP first. Therefore, let’s activate the PHP Hypertext Preprocessor on every page at this time…

No Joke

Where I live PHP stands for Philippine Peso!

Changing to PHP

We will now change all the .html file extensions, with XHTML in them, to .php!!

For example, menu.html was changed to menu.php and contact.html was changed to contact.php.

Take notice, we did not change the XHTML content.  It is still XHTML and will still be served as XHTML. The only difference is that any php statements will be executed first (at this time there are no php statements! That comes next!)

Changing the Links

With all the file names changed from .html to .php, we need to change all the links on all the pages too.

With Geamy this is easy as 1 – 2 – 3

  1. Open all .php files in Geany.
  2. Use the Search -> Replace menu item to replace all .html with .php in your Session (all open files).
  3. Click the “Save all open files” icon.

Success!

I know it sounds entirely too simple, but that’s it! The PHP Hypertext Preprocessor will now load and execute on each of these pages!

Congratulate Yourself !!!

Leave a Reply