Archive for the ‘code’ Category

Why is my Favicon not updating or refreshing?

Posted on: January 10th, 2017 | Category: code, Design, PHP, Xhtml/Css

Recently I was asked by a friend why his new and fancy favicon wasn’t showing in his browser. Since I have struggled with this annoying (yet very easy solveable) problem in the past as well, I decided to write the solution down once and for all.

The problem with no updating or refreshing favicons is due to the fact that they are very firmly cached by the browser. Even a hard refresh doesn’t solve the problem.

You can solve this very easyily by making sure there is a unique querystring (?v=x, where x is an unique number) in url to your favicon like this:

<link rel="shortcut icon" href="path/to/favicon.ico?v=2">

Every time you update your favicon, you just add another unique ID in the querystring and the problem should be solved!

If you change your favicon a lot (e.g. during design/development process) you can also automate this. This PHP example generates a unique ID every time.

<link rel="shortcut icon" href="path/to/favicon.ico?v=<?php echo uniqid(); ?>"> 

Automatically update the copyright on your website with PHP

Posted on: March 15th, 2010 | Category: code

This is one of those little things you always forget, probably because it’s so small and insignificant.

Did you ever have a client call or e-mail you with the question to update the copyright on the website you created for them last year? I know I have had those questions from clients (rightly so).

With this little code snippet you’ll never have to worry about it again.

Place this somewhere in your functions.php (or whatever you named it):

<?php
function printCopyright($startyear) {
	$currentyear = date(Y);
	if ($startyear == $currentyear) {
		echo 'Copyright © '. $startyear;
	}
	else {
		echo 'Copyright © '. $startyear .' - '. $currentyear;
	}
}
?>

Once that is in your functions.php you can just use this: <?php printCopyright(2010); ?> in your template where you want your copyright to be printed. It takes one parameter, the year you want your copyright to start or has started.

If the current year is also the year your copyright started, then it will return “Copyright © 2010” and if your copyright started earlier (let’s say in 2007), then it will return “Copyright © 2007 – 2010”.

Tags: ,

How to remove an element from an array

Posted on: May 17th, 2007 | Category: PHP

Soo, I’m learning more and more php these days and today I stumbled onto a problem, which I couldn’t solve myself.

How do you remove an element from an array in php?

After a quick google search I found this:

foreach($array as $key => $value) {
          if($value == "" || $value == " " || is_null($value)) {
                    unset($array[$key]);
          }
}
/*
and if you want to create a new array with the keys reordered accordingly
*/
$new_array = array_values($array);

Tnx to Scriptygoddess

This works okay, but I’m wondering if this is the best/quickest way to remove an element from an array?

And isn’t there a built-in function in php that does the same thing?

Linkypoo 20 mei 2005

Posted on: May 20th, 2005 | Category: Web, Xhtml/Css

Linkypoo 17 mei 2005

Posted on: May 17th, 2005 | Category: Xhtml/Css

Linkypoo 13 mei 2005

Posted on: May 13th, 2005 | Category: Linkdump, Software, Xhtml/Css

Linkypoo 13 maart 2005

Posted on: March 13th, 2005 | Category: Design, Xhtml/Css

CSSVault verkocht

Posted on: January 24th, 2005 | Category: Web, Xhtml/Css

Scrivs heeft de CSSVault verkocht.

De CSSVault is toch een soort van instituut geworden in het promoten van web standards en design.

Het is jammer dat het verkocht is en de vraag is hoe het er in de toekomst uit gaat zien. De nieuwe eigenaar zegt dat er weinig zal veranderen. We zullen zien.

Maar voor dat geld ($XX,XXX) had ik het ook gedaan :)

Tekstomloop op het web

Posted on: January 11th, 2005 | Category: Design, Xhtml/Css

Dit is eigenlijk een reminder voor mezelf, om hier eens mee te gaan spelen.

Linkypoo 24 november 2004

Posted on: November 24th, 2004 | Category: Design, Xhtml/Css