JavaScript: difference between null and undefined

Programming in JavaScript, surely all we ever found us in the position of having to execute either a block of code or another depending on whether a variable is “null” or “undefined.” Today we will analyze the difference in JavaScript between “null” and “undefined“, since we have to be very careful when we compare them. Read more about JavaScript: difference between null and undefined[…]

JavaScript and CSS minified with Carabiner in CodeIgniter

Today we will talk about a powerful library available for the framework CodeIgniter, it is: Carabiner. This library allows us to include specifically for each view of our site the JavaScript and CSS files that are needed, avoiding to have to include them all at once, and also it sends them to the user in only one single file .”js” and one “.css” with all that we have including before but minified, so the size of the “.js” and “.css” that are sent to the user is much lower, with the improvement of loading time of the site that this implies.

Installing Carabiner in our project

The first thing we need for installing Carabiner in our CodeIgniter project is to download it. We can download it from the CodeIgniter forum. In order to install it, we simply have to place the files “carabiner.php”, “jsmin.php” and “cssmin.php” files into the directory /application/libraries of your project. Once this is done, we have to place the configuration file “carabiner.php” into the directory /application/config. In this file we have to specify the path to the directories that contain our files “.js” and “.css”.
[…]

Upload progress bar in CodeIgniter without Flash

Today we will see how we can create a progress bar file upload in CodeIgniter without the need for libraries or plug-ins made with Flash (like SWFUpload) that are beyond our control, because usually these libraries offer us already compiled .swf files, so we can not change anything in them, just in case we have knowledge of programming in ActionScript 2 or 3.

First of all, we have to say that creating a progress bar file upload in PHP is not as easy as it seems. The first problem is that PHP versions prior to 5.2 do not provide the necessary tools to provide information about the file upload at every moment. The second problem is that AJAX, by itself, does not allow us to check the status of the file upload process, since, for obvious security reasons, JavaScript does not have access to files on the client operating system, so you need a “trick” using an iframe.
[…]

scrollTo: The jQuery plug-in and our CSS

The jQuery plug-in scrollTo (developed by Ariel Flesler) enables us to make our website to scroll (scrolling the vertical bar) to any item on our document we need, this way we can focus the user’s attention in that element each time the page is reloaded (for example, an entry in the left menu on our website), sparing the user from having to do it manually. On the website of the plug-in project you can find all (or almost all) the documentation that is needed to integrate it into your own project.

Bug fix in ImageFlow 1.3

Today we are going to fix a bug I found in updating ImageFlow, going from version 1.2.1 to 1.3. The new version is intended to solve, among other things, the problem that was in Internet Explorer when there was only one image in the gallery. The problem was that nothing was showed if only we had a picture in the gallery in IE. Well, version 1.3 already displays the picture if we only have one, but if that image also has a caption, it turns out that the caption is not shown, nor Internet Explorer or any other browser . Well, here is the solution for those wishing to fix the bug (and are brave enough) and want to get their hands on the code of the library.

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.
[…]

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. […]