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.
Video Screencasts → #11: Working Modularly with PHP
#11: Working Modularly with PHP
Chris Coyier
on
(Updated on )
Isn’t is better to use ‘if-else’ instead of that ultra-complex css?
Love your tutorials ;)
Fantastic tutorial Chris! A new breakthrough in the way I think about designing websites!
Thanks for the great tutorials! I just used this one on my website…
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.
is no longer available for download from the itunes podcast could be reviewed, Greetings
Instead of that css trouble of selected page, you can add this snippet for printing the menu.. much easier, and then it will have “selected” as class on the page its on..
pastebin : http://pastebin.com/23ck7PKk