I’ve just had some great fun trying to add a browser Favicon to a website I am working on. We don’t get much client demand for these, so it’s been a while since I’ve had the task of creating one.
I decided to read-up on Wikipedia and on W3.org before-hand and followed all of the suggestions therein. The result? Icons which show in Firefox, Safari and Opera but not IE 7 or 6. What a surprise!
A further Google search revealed that IE is a bit strange in it’s handling of Favicons. Apparently, if you already have the site bookmarked without an icon, you must remove then re-add the bookmark to get any new icon to show. Unfortunately I have tried doing this and the icon still fails to display in either my bookmarks, in the location bar or within my page tabs so I’ll have to do some more research.
This is turning into a lot of work for such a simple gimmick…
I’ve been working on a site which uses the CodeIgniter PHP framework for a few days.
I added a custom CMS area to the site, which I wanted to place in a password-protected directory. I needed to turn the Rewrite Engine, (which CI uses extensively), off for the CMS’ URL but for some reason Apache throws a spaz if you try to use the ‘RewriteEngine off’ directive along with the ‘require valid-user’ directive.
Basically, the authentication was working as expected but for some reason the ‘RewriteEngine off’ directive was getting ignored… Strange, but a Google search indicates it’s a well-known bug. Easy to fix, though, with some edits to my .htaccess files.
RewriteCond $1 !^(index\.php|staticfiles|robots\.txt)
RewriteCond $1 !^(401.shtml)
RewriteRule ^(.*)$ /index.php/$1 [L]
AuthName "Restricted Location"
A year or so ago I was given the task of returning rows of data from a MySQL table in a randomised fashion. This in itself is fairly easy but the project which I was working on displays the data in a paginated format so a constantly shifting random data order would not work. The client also requested that the random order should “re-shuffle” every once in a while.
My solution was to seed the random order with a hash of the current year and month concatenated with each row’s ID value. This means that the random order would be re-shuffled on a monthly basis.
The only caveat of this method is that it’s possible for an end-user of the system to be looking at the site at time of shift, messing up their pagination. But then, with a shifting random order there would always be that possibility!
SELECT *, MD5(CONCAT(DATE_FORMAT(NOW(), '%Y%m'), `id_column`)) AS `rand_col`
ORDER BY `rand_col` ASC