Archives
- March 2010 (1)
- February 2010 (1)
- January 2010 (2)
- December 2009 (1)
- November 2009 (2)
- October 2009 (5)
- September 2009 (1)
- March 2009 (3)
- February 2009 (1)
- January 2009 (2)
- October 2008 (1)
- September 2008 (5)
- July 2008 (1)
- June 2008 (5)
- March 2008 (1)
- January 2008 (1)
- December 2007 (5)
- November 2007 (8)
Categories
Blogroll
Tag Archives: PHP
Using Texter to speed up web design/development
Lifehacker’s Texter let’s you define short macros that allow you type a little, and get a lot back. I’ve not used this before, but am constantly finding myself typing the same bits over and over and over, so this is a very neat and helpful little tool.
Basically, you just define a command, then specify what [...]
Enable better caching on your website using PHP
Just a quick snippet to help you tell useragents accessing your site that the content hasn’t changed.
?View Code PHPfunction caching_headers ($file, $timestamp) {
$gmt_mtime = gmdate('r', $timestamp);
header('ETag: "'.md5($timestamp.$file).'"');
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime || str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == md5($timestamp.$file)) {
header('HTTP/1.1 304 Not Modified');
exit();
}
}
header('Last-Modified: '.$gmt_mtime);
header('Cache-Control: public');
return 1;
}
Then call this in the top of your code like [...]
5 mistakes new web developers often make
Image via Wikipedia
Having talked to some university students who had taken computer science/IT degrees, I was amazed by how little they seemed to know about making anything that’s secure or even remotely logical. The group I met with primarily had been taught PHP. Having looked at some sites they were designing I realised 5 things [...]
How to know that your PHP is borked before your clients kill you