SWFUpload in CodeIgniter

In this post we will explain a little what it is and how we can use SWFUpload library in our application made with the php framework CodeIgniter, so that, our users can upload their files to the application in an elegant and visual way, and all combined with safety and ease that CodeIgniter offers for uploading files to the server.

What is SWFUpload?

SWFUpload is a library that allows to our website’s users to upload files to the server, using a combination of Flash and JavaScript.
[…]

Sending forms with AJAX in CodeIgniter

Today we are going to explain how we can send a form via AJAX using jQuery in CodeIgniter, so we avoid to reload the whole page, giving the appearance of “desktop application” to our web application, being able to perform certain actions without reloading the entire page view.

Creating the form

First, we need to create our form. In this case we will create a generic form, where we will add different types of fields to make the example as complete as possible, but functionally not very helpful, mainly for teaching purposes… So in our view file in CodeIgniter we add the following code:
[…]

ImageFlow in CodeIgniter

This time I will explain how to include JavaScript library called ImageFlow within the CodeIgniter framework and make it runs at the first time, which is not easy! Also, I will explain some small modifications to the code of the library. Then we will see an example of how to include it and finally we will see the PHP module required for proper operation. But first, let’s see what is the library ImageFlow and what it does.

What is ImageFlow and what is it for?

ImageFlow is a JavaScript library that allows us to add a really elegant image gallery in our website in a very simple way, making it look like Flash without the drawbacks that technology can bring. So, in this way we can show our image gallery how we want, since it has a large number of configuration parameters, to give it the appearance and behaviour that we like or need for our site. But that is enough and let’s go to the important, the integration into CodeIgniter.
[…]

PHPMailer in CodeIgniter

In a previous post I talked about how to use the library PHPMailer to send emails from our website without having our own mail server running on the machine. This time we will go a step further and explain how to integrate this library in our CodeIgniter project and not die in the attempt.

The first thing we do, if we have not done it yet, will be to download the library. Once we unzip the library, we can rename the folder named PHPMailer and move it to the folder /system/application/libraries (for CodeIgniter 1.7.3 or previous) or to the folder /application/libraries/ (for CodeIgniter 2.0 or later) in our CodeIgniter application. Once we did it so, we can start to implement our own library, which will be in charge of including PHPMailer into our application. To do this we have to create a new PHP file in the CodeIgniter’s library directory called my_phpmailer.php. In this file we will write the following code:
[…]

CodeIgniter and JSON with jQuery

In this post, we are going to talk about how to receive data in CodeIgniter via JSON, using for that the JavaScript framework jQuery. But before that, we need to clarify a bit what is JSON and what is it used for.

What is JSON? What is it used for?

JSON stands for JavaScript Object Notation. So, it is a way of writing the properties of objects in JavaScript so that they can be sent between client and server and vice versa. This format is very light due to its internal structure, which is quite human readable, and it is very easy to process by machines. While there is a debate about which format is better, if XML or JSON, for sending and receiving data via AJAX, there is a large community of developers who bet on JSON as the AJAX communication technology that will prevail in the future, alleging among other things that being lighter than XML the communication between client and server is faster. […]

Automatic configuration of URL in CodeIgniter

In this mini-post we are going to explain how to configure our CodeIgniter in order to make it run on any server without having to be modifying the parameter “base_url” in the configuration. So, we can move our development version of our site to another different server (let’s say, the production server), without worrying about this parameter.

Inheritance between controllers in Codeigniter

Today, we will talk about the inheritance between controllers in CodeIgniter. At first glance, it could seem very simple to do and it should not be more complicated than this:

class Parent_controller extends Controller {

    function __construct()
    {
       parent::Controller();
       ...
    }
    ...
}

class Child_controller extends Parent_controller {
    function __construct()
    {
        parent::__construct();
        ...
    }
    ...
}

If we run this code as it is, CodeIgniter will return an error saying that it can not find Parent_controller class, which I founded quite surprising. […]

How to create triggers in phpMyAdmin

Some time ago I needed to create a trigger in my MySQL database and I tried to do it through phpMyAdmin. If you have tried it some time, probably, you have already realised that it is a “complicated” task. I say complicated because phpMyAdmin does not allow you to use the standard MySQL sintaxis to create triggers in your database. So, today I will show you a way to introduce triggers in your MySQL database using phpMyAdmin for that. […]

Adding AJAX to Codeigniter with jQuery

Today we will talk about adding AJAX to the PHP development framework called CodeIgniter. When I started to work with this framework I found rather strange that there was not too much information about how to integrate AJAX into it, since it is a relatively known framework and AJAX methodology is very common in web development. When I had the need to integrate AJAX using the JavaScript framework jQuery into my application made with CodeIgniter, I have been looking for information about this subject on the Internet and the truth is that, besides being very scattered, it is not very abundant and not very clear, so here it is my contribution from what I have learned, hopefully useful. […]

PHPMailer: Send emails from your site

This time I would like to talk about the library PHPMailer. This library is ideal if you need to send emails from your web site to its users (e.g: for notifying the data suscription, warning about the near account expiration, etc). A very interesting feature offered by this library is allowing us using a GMail account to send emails (of course, we must be the owners of that account). […]