Add tweets and get latest tweets from Twitter using Twitter API
Posted on Monday 27 April 2009
This weekend I made a twitter module for our CMS. This was fairly easy to do. I included the files. You can download them below. I think the curl module has to be installed on your webserver to use it. You can get your latest posted tweet with the variable $last_tweet. To echo all of your latest tweets use the variable $twitter_tweets. It also includes a javascript file to limit the amount of characters. Twitter only allows tweets of 140 characters. Don‘t forget to change your twitter credentials on top of the index.php file. Change the $twitter_username to your username and the $twitter_psw to your password.
PHP XML sitemap generator
Posted on Monday 20 April 2009

Recently I came across a php script that automatically generates an XML sitemap.The script crawls through a website, searching for href‘s within the same domain. I‘ve altered the script a bit so it lets google know when a new xml sitemap has been generated. When your website changes a lot you should frequently update your sitemap. By using this sitemap generator you can do this without any hassle.
You can change the location of the sitemap within the index.php. Just alter the variable $filename to your location (line 451 or so). You should also change the paramater $url_xml in the pingGoogle function on line 494 to the full path of the sitemap (e.g. http://www.domain.com/sitemap.xml). Otherwise you‘ll get a 400 error on pinging google. Make sure sitemap.xml has write permissions, so chmod sitemap.xml to 777.
Focus on first form input field or textarea onload page using jQuery
Posted on Thursday 9 April 2009

This Javascript basically only sets the focus on the first form input field or textarea of a form when the page is loaded. i use this in my CMS because I hate it when I e.g. have to manually type in a list of emails in a form always click in the first input field to start typing again. This script uses jQuery.
Limiting the length of characters in a textarea using javascript
Posted on Wednesday 8 April 2009

I use a javascript that‘s very easy to use. All you need to do is include the JS file and add a maxlength attribute to a textarea element with the amount of characters you want to allow. That‘s it. I use this to limit the input of characters for page meta-tags to 160 characters.
e.g.
< textarea cols="60" name="field" rows="3" maxlength="160">
And add onload=‘setMaxLength()’ to the body tag:
< body onload="setMaxLength()">
How to make a simple jQuery Ajax request
Posted on Monday 9 March 2009

jQuery is an amazing javascript framework. It‘s makes Ajax so easy. You don‘t have to know anything about Ajax to use it. I‘ve made a simple example on how to use jQuery to make an Ajax request. First, start with creating a database with the name jquery_ajax. I‘ve included the sql dump in the example. In the database there‘s 1 table, called comments. Then we‘ll need to include jQuery in our html file. Next, add a div with a class loading. In the css file the loading class is hidden so we‘ll use
to hide it. You can call the jQuery.approve() function on whatever DOM element you like. Here we‘ll pass on 1 parameter (the id of the comment to be approved) to the function.
input id=“1” onclick=“jQuery.approve(1);” type=“submit” value=“Awaiting approval”
Database table with all the countries, Belgian cities and dropdown with all the countries
Posted on Tuesday 3 March 2009
Below you can download a zip file with SQL dumps of all the countries and another SQL dump with all of the Belgian cities with their postal code, longitude and latitude. I‘ve also included a dropdown with all the countries. I found this on the Snipplr website.