Home

Trim long texts by words in PHP

We don’t like reading chopped sentences like “Star Wars Old Republic is be….”. It looks fugly. Usually, when trimming text you will go with substr(), but there is a much better way to do it, and believe me, you trimmed…

Alternate row colors with PHP

I know there are several ways to accomplish this, however, of all the ones I’ve tried, this is the shortest so far: So, if you make two classes, row1 and row2, each with a different background color, the result will…

Element indexes and jQuery

Once the DOM is structured by the browser, each element in our HTML page has an index relative to its parent. Retrieving an element’s index with jQuery is an easy task, and it is so useful that it can save…