HTML Table Class on CodeIgniter 2.0

Posted by on Aug 31, 2010 in CodeIgniter, PHP | 3 Comments

CodeIgniter 2.0 is coming out soon, so lets start studying the changes done to the HTML Table Class in the dev-release. One of the most requested features was the ability to set tag attributes to individual cells. On CI 2.0 this is completely possible, however, since the documentation is not fully updated yet, I decided […]

Fixing UTF-8 encoding problems on MySQL queries with PHP

Posted by on Aug 24, 2010 in MySQL, PHP | 4 Comments

It happened to me a lot of times, I had my connection set to UTF-8, my database was UTF-8, even my tables and every single field, however, for some reason, the information I updated in phpMyAdmin wasn’t being displayed correctly on my website and the information edited on my website wasn’t being displayed correctly in […]

Twitter feed on your website with cURL and PHP

Posted by on Aug 15, 2010 in PHP | 3 Comments

Pulling code from here and there, I gathered enough information to create a small function that allow you to pull your Twitter feed and display it in your website. What you do is basically call the function and pass a couple parameters. The styling can be done with CSS.

Alternate row colors with PHP

Posted by on Aug 10, 2010 in PHP | 3 Comments

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 be alternated row colors in whatever you’re doing. Very useful for long lists. Update: you […]

Element indexes and jQuery

Posted by on Aug 10, 2010 in jQuery | No Comments

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 you a couple of lines of code.

Change selected option by value on select list with jQuery

Posted by on Aug 10, 2010 in jQuery | 3 Comments

You have a select element, and you need to “select” one of its options based on one of its values. What you do is use the “selected-selector” of jQuery to do it in a single line. Lets say I have the following select element and I need to dynamically select the option with a value […]

Fix / workaround for the z-index problem on IE7

Posted by on Aug 9, 2010 in CSS, XHTML | No Comments

IE7 behaves strangely when we talk about z-index. It doesn’t always respect the z-index values of our elements. However, if you come around this weird stuff, just add a higher z-index to the parent of the element you want to put above everything else. Don’t ask me why this works but it does! Lets take […]

Create thumbnails on the fly with CodeIgniter

Posted by on Aug 9, 2010 in CodeIgniter, PHP | 9 Comments

Before explaining the solution, you should know creating thumbnails on the fly is server inefficient, eats a lot of resources and they should be generated as soon as the images are uploaded. However, there are some occasions when we absolutely need to generate thumbs on the fly. In this article we will learn how to […]

Add www subdomain automatically to your domain with htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Sometimes we need to add the www to our domain automatically, maybe for aesthetics or ajax issues across subdomains. Apache .htaccess is our friend here. You just need to add this to your existing .htaccess file or just make a new one with the following contents:

Prevent image hotlinking with Apache and htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Question of the million dollars. Those annoying image hot-linkers, eating our bandwidth, our food, our… nevermind. Anyway, if you want to give them hell and stop this behaviour, add the following to your .htaccess file (remember to edit your domain name): Bonus!: In the third line, you can optionally write your server IP for an […]

Prevent directory listing in Apache with htaccess

Posted by on Aug 9, 2010 in Apache | No Comments

Piece of cake. If you need to prevent your files, images or anything else to be listed in those directories where an index file is not present, just add the following to your .htaccess file: Piece of cake.