Todays code example is really more of a fluke. I have always found myself trying to write interchangable and easily updatable html and found that since i moved to CSS that is more of a challenge. Instead of trying to write different classes that would handle everything you need and trying to make them very specific you can break things down into simpler forms.
and you use them as follows:
In my projects i often come across or up with cute pieces of code that i think may be interesting to others. Instead of hoarding i will be posting them (possibly in sub pieces) so you can take part in the fun.
Todays Fragment: Per File Execution Testing
You can use this piece of code to test the file being executed and perform unit testing or output debug information as necessary. It can also, as is being used here, be used to redirect the user away from executing this page.
if ($_SERVER['SCRIPT_FILENAME'] == __FILE__)
I dont think the exit is entirely necessary, but it may be dependent upon the server’s configuration.
I have some serious issues with what I am about to say, but please bear with me.
Development is as much an art, as much a science, as much a skilled and science driven thing, as air is fun to breathe. Sometimes I get energetic about being able to expand my rib cage and feel the cool air flowing through into my lungs, helping me expand them more, and I continue expanding until I cannot quite expand them any more and I sit. I stretch out my rib cage, allowing my muscles to wonder when they are going to receive their oxygen and close my eyes. It is a lot like holding my breath, only I am not intending to turn blue.
Continue reading “Bad Code”