Grow your CSS skills. Land your dream job.

#11: Working Modularly with PHP

Many sites do not use any fancy Content Management System (CMS) to generate their pages, they are just just good ol' static HTML content. A site for your grandmothers pie baking business probably only has a few pages, perhaps a homepage, about page, and contact page. Each of these pages has different main content, but much of it stays exactly the same, like the header, navigation, and footer. Think of these sections as "modules" that you can easily use PHP to insert into the page. This way, making changes to those sections changes all the pages at the same time, saving you time and potentially mistakes. At the end, I show you how you can still achieve unique effects in your navigation despite the code being identical.

Comments

  1. Eduardo
    Permalink to comment#

    Isn’t is better to use ‘if-else’ instead of that ultra-complex css?

    Love your tutorials ;)

  2. Permalink to comment#

    Fantastic tutorial Chris! A new breakthrough in the way I think about designing websites!

  3. Tom
    Permalink to comment#

    Thanks for the great tutorials! I just used this one on my website…

  4. Ryan
    Permalink to comment#

    Yes you can tell (at 6:10 of the video) that the html code was inserted via php. The way you indent and space your code is unique and you wouldn’t make a simple html indentation mistake like that had it been in an html file and not included using php. A way to fix that, depending on how your organizing your code, would be to use the same spacing as you would a normal html file. So your paragraph tag would a have a couple tab indentations in the header.html file, but your heading tag is fine because php includes the file right where you put the php include statement with the spacing.
    I hope this makes sense. I’m enjoying your screencasts very much! Keep it up Chris.

  5. is no longer available for download from the itunes podcast could be reviewed, Greetings

Leave a Comment

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".