PHP is Not a Drug

Posted March 25th, 2005 by Mike Cherim

PHP is not a drug — even though it may sound like one, namely PCP, but it sure can be addictive. Considering all that it can do for web design and development, its benefits and potential uses cannot be overlooked. Thus, once developers begin employing PHP in their web sites, it’s really difficult to stop.

On my Green-Beast.com Main Site, if you were to view the source code, not on your end, but on mine, it would be a shock to some. If you viewed my source code on your end what you’ll see is something very similar to what you’d see if you viewed any cutting-edge site’s mark-up. But looks can be deceiving. You see, the page you call when you click a link is akin to a skeleton. When you click a link and call up the page, that skeleton, with it special PHP programming calls for several files: The header, the footer, the navigation links, the page links, just about everything on any page on that site, is a separate file. Over 100 tiny files of only a few kilobytes each. (This web log is the same way.) You see, when you call for a file from the server, several files get "called" as well so they are included. And this is all done on the server and presented to you as a complete page. These files are often referred to as Server-Side Includes. The point of this is to make the pages faster, while reducing the load on your end and the bandwidth consumption in between. If you call up the pages on a browser with good caching capabilities, such as Mozilla’s Firefox®, due to the presence of global files, like the header, and if your connection is fast, you’ll see every little change as you switch pages. The reason is simple: You only really have to load the changed content. This is efficient design.

Much of what is accomplished on Green-Beast.com can be done with JavaScript. JavaScript, however, is a scripting language which works on your end, on your machine, on your browser, assuming you have the capabilities and it’s enabled. The PHP server-side scripting I use makes all of this null and void. You need nothing to have it all work as I planned. In fact, Green-Beast.com and this web log, too, use no JavaScript. If you were to disable JavaScript (by disabling it with your Firefox browser’s Web Developer’s kit tool box — a FireFox plug-in — for example) everything would still work with exception to the way external links open. I do use a Script-Type HTML element to have external links open a new browser window (most of them on this site, too). If you were to disable scripting on your end, the same links would open in the same window. That’s the only thing that would change. (If you want more information about the links on Green-Beast.com, please check out the Green-Beast.com Site Navigation Information page section.

Server-side scripting is nothing new. You may have heard of ASP, PERL, ColdFusion, JSP, Python, or even CGI. These are all server-related and perform various tasks. The PHP I use not only calls the files when you request a page here and on Green-Beast.com, it makes my contact forms work, it remembers when you comment on an article (on this web log), but it also controls the style-changing functions I offer on Green-Beast.com and handles the cookie functions so your style choice is remembered. Without the cookie, you’d revert back to the default style with every page turn. With the cookie being employed your choice is retained. Moreover, it’ll remember you when you come back to visit again presenting you with your last style choice — provided you return using the same computer and browser. It’s really amazing. I have an awful lot to learn about this particular subject, but I find it very useful and intriguing, to say the least.

Want to learn more about server-side scripting and programming? Check out these information resources:

I could provide more links, there are thousands of them, but I’ll leave you with these. This should be enough to get you started. If you want more, you can search the web with Google.com or your search engine site of choice and you’ll likely find more than you’ll ever need or have the time to check out.


4 Responses to: “PHP is Not a Drug”

  1. Joshua Kendall responds:
    Posted: March 29th, 2005 at 12:28 am

    I know you said “I could provide more links, there are thousands of them, but I’ll leave you with these.” but a really good one to mention is Webmonkey. It really helped me learn and offered good tutorials that could come in handy.

    Also like the rest of your work good job. Nice site.

    - Joshua Kendall.

  2. Jared Armstrong responds:
    Posted: November 1st, 2005 at 10:29 am

    It’s the first time i ran through your site and I found it very informative and interesting. Nicely done!

Sorry. Comments are closed.




Note: This is the end of the usable page. The image(s) below are preloaded for performance only.