Thursday 5 September 2013

Things Codeigniter Lacks



Things Codeigniter Lacks


This is my first ever post. I have been using Codeigniter for two years now. Although i liked this framework too much and this gives a kick start to a new programmer. I have used this framework following techniques of Jamie Rumbelow by customizing MY_Controller and MY_Model. I should mention here Phil Sturgeon's template library the best one. The CMS based on this framework called Halogy is the product i like most which is under development again now. Customizing after too much research and googling it is still gives some lapses which i would like to share here.


1. Extending Core Classes


        Extending core classes is a great functionality for programmers and gives control over the framework. How ever, this is also a pain if i need to work on multiple projects where there are different requirements for each project and each time i am bound to customize core classes to meet my requirements.

2. Creating Instance


    In Codeigniter you may have seen that  for many libraries and helpers you are creating instance something like this

    $CI = &get_instance();

Although this way you can access parent class any where in the application just by calling above instruction but programmers like me are lazy enough to use this. I wanted to gain access over the instance anywhere in the application without initializing the instance every time. I have seen another great PHP framework called Laravel (where i am moving now after using CI for two years) is giving exactly the same thing i want. The reason is that it caused me a lot of problem while coding because with Codeigniter i am habitual to use $this keyword and if i forget somewhere to initialize the instance than it produces problem and it is a time wasteage. I should mention here Laravel uses static methods which does not need to load or include before using.


3. File Upload


    The problem with file upload is pretty simple but i am surprised to see no one has ever mentioned this problem in the blogs and articles and even forum (or i may be missing). When working with file uploads with other form data and great form_validation class. To understand this problem let's go step by step.

I have a form with file field and text boxes and other input boxes. Now using form validation class i can validate fields. While validating a file field i am bound to use do_upload method of Upload class. The problem rises when text boxes validation fails and file has been uploaded to server. This is not what i want. What if validation fails for 5 times. Five files will be uploaded to server and take space. Instead i only wanted to validate file and if validation is successful than upload the file. I had to do a work around for this problem by extending Upload class.

Here is a reference to my work.


4. Pagination


     Another lack i see is pagination problem. Although pagination class is simple and good but it would be batter if we can use a per page functionality. I mean if there exist a method that would allow user to view how many records per page he wants to see but i found about this no luck and of course, i had to do work around for this too.

These are simple thoughts. I don't say Codeigniter is bad but i need this in a framework and i expect a framework is what provides more control and easy to a programmer. People might have found other things too and i am expecting Ellis Labs to improve the Codeigntier version with all the things that attracts programmers.

No comments:

Post a Comment