Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport)

18 February 2009 » In Code Igniter, General, PHP, Programming, Web Development »

Greetings to all the readers of my blog.

Many of you have been writing to me in the last couple days when I took the site down. The main objective was to add the new theme and push a few code updates of the existing libraries. I really appreciate your concern and would like to reassure you that the site is up and will be up as usual :) Now, besides the slightly customized theme from Elegant Themes, I have put a few code updates. They are detailed below:

Extended Model for CodeIgniter

The original version of the Extended Model for CodeIgniter has been serving many people well. Although most users loved the nifty functions of the Model, many (including me) didn’t like the hacking of CI core to get this functionality. With the release of CodeIgniter 1.7, we can avoid that as we can now overload the Model class of CI like the other libraries. Follow this instruction:

1. Download the updated version from here
2. Put it in your application/libraries folder
3. In your model files, use it this way: class Product extends MY_Model
4. Everything else is same just like the original one

HTTP Class

There is not much update in this class except for a few bug fixes (thanks to you guys). Also, I have included a license file in the package as many of you have asked. It’s released under the MIT license. The original post is here for reference.

Download the update from here and the API reference is here.

Cross-domain AJAX calls using PHP

A minor bug fix in the code. Thanks to a few of you who pointed them out. Original post is here. Download the update from here.

I have accelerated plans for the blog in 2009 so stay tuned for some worthy posts in this month. And do write to me if you feel you have any questions/ideas/suggestions.

Cheers!

Share and Enjoy:
  • Digg
  • DZone
  • Twitter
  • Posterous
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Simpy
  • Ping.fm
  • Tumblr

Tags: , , , , , , , , ,

Trackback URL

10 Comments on "Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport)"

  1. admin
    Ryan Blunden
    19/02/2009 at 5:27 pm Permalink

    Hi Emran,

    Many thanks for these excellent classes!

    I've used the Extended Model class in a recent project and it saved me so much time in not having to create the simple Models just to do basic insert, save, findAll etc. Great work!

  2. admin
    g
    25/02/2009 at 8:13 pm Permalink

    very good

  3. admin
    starrynighthn
    27/02/2009 at 7:37 pm Permalink

    I've found 1 bug in MY_Model:

    When I use $returnArray = FALSE, findCount() got error. So I changed this code:

    $data = $this->findAll($conditions, 'COUNT(*) AS count', null, 0, 1);

    if ($data)
    {
    return $data[0]['count'];
    }

    to this:

    $data = $this->findAll($conditions, 'COUNT(*) AS count', null, 0, 1);

    if ($data)
    {//fixed by starrynighthn
    if ($this->returnArray)
    return $data[0]['count'];
    else
    return $data[0]->count;
    }

    and everything works well.
    Hope you fix this bug. ;)

  4. admin
    Mike
    28/02/2009 at 3:49 am Permalink

    Emran, thanks for making this available.

    I was wondering if you could post some sample code showing how you generally use the extended model, specifically when creating a new record.

    Thanks.

  5. admin
    $@!ful
    09/03/2009 at 7:00 pm Permalink

    Nice job…

  6. admin
    North2Alaska
    23/05/2009 at 4:18 am Permalink

    On line 123 of the My_Models.php file, shouldn't the constructor by My_Model instead of just Model?

  7. admin
    Ron
    21/09/2009 at 3:44 pm Permalink

    Hi Emran,

    Great job on this! I was testing it out and it worked perfectly.

    One thing though–is it possible to join tables with this? For example, if you have two tables such as 'products' and another called 'images', where product image names are stored in the images table. How would you do the combine and throw in a condition?

  8. admin
    Md Emran Hasan (phpfour)
    21/09/2009 at 10:36 pm Permalink

    Hi Ron,

    At this moment JOIN is not supported within this class. The purpose of this
    class is to assist with most regular DB operation, not the complex ones. I
    believe when using JOIN, the query should be hand-written with proper
    ordering etc.

    Glad this is helping you!

    Emran

  9. admin
    Prevolution
    22/07/2010 at 10:02 am Permalink

    Thanks for this library! It helped me very much :-)
    There was problems with cookie transfer, but I replaced this line:
    $cookieString = join('&', $tempString);
    with this:
    $cookieString = join('; ', $tempString);
    and it worked for me.

Trackbacks

  1. [...] Extended Model for CodeIgniter Posted by admin in Code Igniter, PHP, Programming, RBS on 07 12th, 2008 | ...

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to Comments