A little bit of everything…
RSS icon Home icon
  • Calculating age with JavaScript

    JavaScript LogoI’ve been working on a simple form – nothing really challenging – where members of a group can provide some data about themselves for registration purposes. However I tried adding an extra function to it: a small text field next to where they input their birth data, which displays their age (according of course to the birth date they provided).

    I thought therefore I could share this small piece of code so that other people wishing to add it to their websites can use it. The internet is already full of such scripts, but who knows, maybe someone finds it here and finds it useful…

    Read the rest of this entry »

  • Refreshing DIV content with AJAX (multiple DIVs)

    AJAXAfter reading the post Refreshing DIV content with AJAX, you already know how to refresh the content of a DIV in your website with the help of AJAX. But perhaps you want to refresh more than one DIV, and you’ve realised the code in the other post didn’t work! Don’t panic, as a matter of a fact refreshing multiple DIVs is the same process than refreshing a single DIV. I’ve prepared an example and some code so you can see how easy it is. See the working demo here.

    Read the rest of this entry »

  • AJAXifying your site’s navigation

    AJAXThis post is inspired in Refreshing DIV content with AJAX. However this code does not actually automatically refresh the contents of a DIV but it refreshes them when the user clicks a link. The implementation of the code below allows to refresh the contents as mentioned, but the content retrieved can be different every time. This is very useful to make a website work in a similar way as with frames, but with more advantages and without the disadvantages of frames.

    I provide the code necessary to achieve this purpose but I don’t present it like a step-to-step tutorial. This is because I guess that for anyone with minimal knowledge of HTML and JavaScript is totally self-explanatory and because I would prefer you to make your website look like you want it to rather than like my post tells you to.

    You can see a demo page with AJAX navigation here.

    Read the rest of this entry »

  • Retrieving custom data into EventList

    This is the second part of the post Adding custom fields to EventList, where I explained how custom data fields can be added to EventList Joomla Component by Schlu. In this post I will cover how to take full advantage from those custom fields by making EventList RC1.0 for Joomla 1.5 retrieve the information submitted through them.

    As I mentioned in the first part, EventList does not allow (yet) a user-friendly system for adding custom fields, therefore there’s no user-friendly system either to retrieve custom data into EventList. Some modifications to the core files of the component are required for this purpose. The good news is, that it is not as complicate as it might seem at first.

    Read the rest of this entry »

  • Automatically query MySQL and output results with AJAX

    AJAXThis is an extension of the post Refreshing DIV content with AJAX. I recommend you read it at first because you will understand better what the script below is about.

    What this script does is the following: without having to press any refresh button, and not even reloading the whole page (but a DIV), it retrieves every X seconds the specified data from a MySQL database and displays in the DIV the refreshed contents of it. In other words, it queries the database regularly and updates the output. Read the rest of this entry »

  • Populating a dynamic drop down menu from a MySQL database

    This PHP code snippet retrieves the data in a specific column of each row in a MySQL table. The retrieved data is echoed to the DOM and displayed as options of a drop down menu. The options of the drop down menu are dynamic, as they will change automatically every time the information in the database is modified.

    Read the rest of this entry »

  • Refreshing DIV content with AJAX

    AJAXAJAX (Asynchronous JavaScript And XML) is a keystone of Web 2.0 and is very useful in many aspects, because it offers the possibility to change the structure of the page (DOM). For instance, it makes possible refreshing a part of a website instead of having to use the classic page reload, which requests again the whole page from the server even when the updated parts are minimal (much slower and of course consumes more bandwidth; therefore making the visitor experience worse).

    If you know what a HTML <div> tag is and how to use it, with the help of AJAX refreshing a section of your website is possible. The section which will be refreshed is within a DIV; the rest of the HTML outside the DIV will not be refreshed.

    To show you how to do so, I prepared an example with the code required for this purpose. But if you’re new to AJAX and would like to know how the code works, I recommend you to take a look at first at w3schools AJAX tutorial.

    Read the rest of this entry »

  • Showing registered users in EventList module

    When using EventList module in conjunction with EventList 1.0RC component for Joomla 1.5, I missed the possibility of displaying in the module the number of registered attendees to each event, together with the already showing date, time, event name, etc.

    My approach to the issue was to add some extra PHP code to the EventList Mod template; concretely the code below. But before you attempt to try the same in your website, remember to backup the affected file.

    Read the rest of this entry »

  • America at war: hidden intentions?

    RMS Lusitania was a British luxury ocean liner torpedoed by a German U-boat in May 1915. At that time it was the fastest commercial passenger liner in the North Atlantic. The sinking of the Lusitania is considered to have been decisive for the United States declaration of war against Germany and thus the involvement of the country in World War I later in 1917. The attack caused more than 1.000 casualties – more than 100 of them were US nationals -, therefore making the sinking of the Lusitania comparable to that of the Titanic in terms of loss of life.

    Sinking of the Lusitania

    The RMS Lusitania (click to enlarge)

    Despite knowledge that the seas around the British Isles had been declared war zone by Imperial Germany some months before, and also the fact that the German embassy in the United States had emitted a warning to potential passengers of the Lusitania in major American newspapers, the ship nevertheless departed New York the 1st of May of 1915. The 7th of May the ship was sunk near the coast of Ireland by the German submarine U-20, hit by at least one torpedo.

    Read the rest of this entry »