Tag Archives: class

Solved: F3 Framework Route is running Twice Programming 02 JUL 2016

I’ve inherited a project written using the Fat-Free Framework (or F3 Framework), which is billed as being a lightweight PHP micro-framework that is intended to be easy-to-use and fast, with a gentle learning curve thrown in for good measure. (In fairness, all three of these points seem to be holding relatively true thus far…)

fat-free framework php

Anyway, the project was written by an outsourced Polish developer, and now that he is no longer available, I’m bringing it in-house and expanding on it. Of course, this means that I’m refactoring it a little bit to better suit my own coding style. However, I hit an annoying snag which embarrassingly held me up for far longer than what it should have.

After making a class/controller name change, I was testing my routing when it became apparent that all of a sudden, one of my routes was running it’s function call twice.

An annoying issue to say the least.

So just a heads up, before you tear your hair out – be sure that your target function does in fact not share the same name of your newly renamed class in which said function resides.

If it does, then the framework will call the function through the run() routing as expected, and following that, the function will be called again… because as you might have noticed by now, the fact that your function is the same name as the class means that it is of course a constructor function.

So yes. I’ve jotted this down as a reminder to myself, that sometimes I’m an idiot.

Related Link: Fat-Free Framework

jQuery: Iterate Through an Element’s Classes Programming 28 DEC 2010

More often than not, your HTML elements will have more than one class assigned to them. Now while it is easy to check if an element belongs to a certain class with jQuery’s built in hasClass function, you’ll be pleased to know it is just as easy to iterate through all of an element’s classes with some basic loop work.

How basic you ask? Well actually a single simple for loop really.

Taking into account that a class is nothing more than an attribute, we can retrieve an element’s assigned classed with a simple


The result is a single string value containing the classes currently attached to the element. To iterate through the classes, we simply break up the returned string with the split function:

var classList = $('#myelement').attr('class').split(/\s+/);

Now that we have an usable array, we simply loop through it in any accepted manner, leaving us with code that looks like this:

var classList = $(this).attr('class').split(/\s+/);
               for (i = 0; i < classList.length; i++) {
                   if(classList[i].length > 0){


Antenatal Onslaught My Life 25 OCT 2010

The time for Jessica to join us in this great big world is starting to quicken its step now, and as a result we now find ourselves having already enrolled in and attended our first antenatal classes!

On recommendation of Andy, we got in contact with one Irene Bourquin, the so-called Dragon of Drommedaris Road, a registered midwife, author and renowned international pregnancy/baby expert that has been servicing the greater Helderberg area for more years than anyone can remember now.

Her antenatal classes are well known around Strand, Somerset West and Gordon’s Bay and it was fantastic news when she happily accepted the two of us to join her class of people expecting late December early January! (If you are wondering, the class groups are specifically staggered so that people attending are all more or less in the same stage of pregnancy and thus all hear exactly the info that they need to when they need to).

Classes are held in Irene’s house in Drommedaris Road, Somerset West, and the first class saw both prospective moms and dads come in two by two where we got to meet Irene, a middle-aged lady of Scottish descent who is as straightforward as they come, takes absolutely no nonsense, contains acres of useful and up to date information to impart upon us and most importantly, has an absolutely hilarious dry sense of humour that is guaranteed to have you guffawing out loud as she teaches you the ins and outs of how your life is going to change, what you need to expect, and most important of all, how to actually physically tackle it.

Although one thinks they know what to do when it comes to baby care, going on what you have picked up over the years, you’ll quickly learn that most of what you thought is completely outdated and it is an absolute eye opener as to what the new ways of doing things are and more importantly, the things that might have been missed out on in the past but which need to be done today.

Irene is an absolute fountain of practical knowledge with the experience to back it up. She makes a wonderful teacher and we truly are blessed to have been pointed in her direction. I’ve been to one class so far, Olifant Pootjies to two (women only class the second time around due to space concerns – stretching and the like), and already I’ve learned how to bath my child, what tools I need in the baby room and how to save tons of money on ear buds and cotton wool, the first because you don’t need them at all and the second because of cotton wool’s ability to bake and expand in the oven! :)

Classes are set to run deep into December, and at R70 a shot, they are more than worth it considering all the info, training and physical products we receive. Her book for newborn parents is already at my bedside table, and we’ve even purchased two books as gifts, specifically targeted at grandparents to ensure that both sets of our moms and dads renew their baby raising knowledge before we let them even close to little Jessica! :P

Antenatal classes.

Now who would have ever thought you would find me in one of those! ;)