Category Archives: Coding
Mar 2, 2009 by Matt | Posted in Coding
DevTips has just introduced me, in a fairly recent article, to a PHP feature that I hadn’t been conciously aware of: Output Buffering. (Why hadn’t anybody told be about this before?)
Without output buffering (the default), your HTML is sent to the browser in pieces as PHP processes through your script. With output buffering, your HTML is stored in a variable and sent to the browser as one piece at the end of your script. Can you already begin to see the performance advantages and post processing opportunities?
The article covers the basic usage output buffering, and the pros and cons of using it. Definitely worth a look. I will have to look into this in depth sometime soon…
Output Buffering for Web Developers, a Beginner’s Guide
Feb 25
You may already be familliar with the problem of MySQL Injection, a common exploit that can cause irreparible damage to a database. You may not be aware of it, but there is an alternative to the “mysql_*” function set. The mysqli functions, for “MySQL…
Feb 16
Finally, the solution for our duplicate content worries is over! Google now supports a new method to specify a canonical URL for your page. This “hint” suggests that Google use this page as the original, and ignore duplicates elsewhere on your domain. You simply…
Feb 15
Arrays certainly are useful. If you’re dealing with associative data, there’s no better tool for the job. Sometimes, you’ll run into cases where it would be useful to store an entire array in a field in a database. It’s not something you want to…
Feb 12
Have you ever wanted to take a string and replace every occurance of a substring with something else? Regular Expression voodoo is what first comes to mind for a lot of PHP developers. But there is an easier way that just happens to be…
Jan 27
SQL Injection is one of the most common exploits. It’s a sneaky technique that takes advantage of unsafe database querying practices to gain access to the database. Suppose you have a input form that asks for an email address for a newsletter subscription. The…
Jan 22
PHP is the web programming language of choice (or scripting language, if you insist…) for many people, and my favorite as well. One thing I find interesting is when it’s taught, by many books and websites, they tend to not spend much time on…
Jan 21
Do you use a JavaScript library — such as jQuery, Prototype, or MooTools — on one (or more) of your websites? That probably adds a good 18-120 kilobytes to your pages’ total size, adding more time to users’ download time. Now, how many websites…
Jan 16
HTML isn’t exactly easy for ordinary people to comprehend and use correctly, and allowing it’s use in web forms then entails measures to be taken to prevent malicious code from being inserted. The infamous John Gruber came up with Markdown, with the help of…
Jan 11
Explode() is a widely-used PHP string function that is also one that tends to mystify beginners looking at others’ code. It’s a nifty little function that you may find plenty of uses for once you know how it works. Explode() takes two arguments, a…