the best site on planet earth

Sharing my neuron activities with the rest of the world

Codeigniter for Joomla

with 30 comments

Yes, it is possible to use the excellent codeigniter framework on Joomla. In fact, I am surprised that it work pretty well with very little modification. The nightmares lies in the URI routing. Joomla uses the traditional uri query method while CI promote the use of segment based uri. I haven’t solve this issue completely, but we I am very confident that this can be done.

Anyway, below are some of the objectives of this project

  • to provide an alternative framework to develop an application for Joomla
  • make sure the application can stand on it’s own (running in a standalone mode, without Joomla)
  • recode a few key Joomla functions such as user access, some Joomla helper function as CI’s shared library

How to use this

Just use your Joomla installer, and point to this file. Done.

If you notice the component is a little big. Codeigniter is bundled and will automatically be installed if required. For this example, please delete your /codeigniter folder if you have one installed as there is a tiny tweak to index.php file.

Notes

  • Do take a look at install.ciexample.php to see some rough work on the CI installer.
  • Note how the database is automatically configured at install time, so user do not ever have to edit the config file
  • Only 1 copy of the application file exist for both standalone and Joomla component
  • Joomla component only have 1 single file, that simply call CI’s index.php file
  • currently only 1 controller is supported per apps, but this can be easily fixed with some routing rules, will fix this later
  • When a different app is installed, it will have it’s own folders (controller/config/views/etc). This makes different apps cleanly separated and will helps avoid conflicts. To remove any apps, just delete the folder

Test URLs

http://localhost/joomla/dev/index.php?option=com_ciexample&Itemid=26

http://localhost/joomla/dev/codeigniter/index.php/ciexample
http://localhost/joomla/dev/index.php?option=com_ciexample&task=listcategory

http://localhost/joomla/dev/codeigniter/index.php/ciexample/listcategory

Download
com_ciexample.zip

Advertisement

Written by azrulrhm

July 17, 2007 at 9:22 am

Posted in codeigniter, Joomla

30 Responses

Subscribe to comments with RSS.

  1. Any updated on CI in Joomla? Any new version of it?

    Best regards,
    Pedro

    Pedro

    December 20, 2007 at 12:46 pm

  2. Does this work with both 1.5 and 1.0 of Joomla?

    Eric Boo

    January 2, 2008 at 8:26 pm

  3. Thanks, Works fine…
    Carlos in Brazil.

    Carlos

    February 5, 2008 at 12:16 pm

  4. Yes, tested and works with 1.5, just need to change the installer xml’s format.

    p9939068

    February 15, 2008 at 11:01 am

  5. One little thing: I can’t figure out how to display admin content using CI. Seems to me we have to install another instance inside /application for admin? Something like /application/ciexample_admin?

    p9939068

    February 15, 2008 at 11:45 am

  6. Answer my own noob question:
    in ciexample’s controller (ciexample.php), change the function index() to something like:

    function index()
    {
    if (substr_count($_SERVER['PHP_SELF'],”administrator”) == 0) {
    echo “Frontend default page”;
    }
    else
    echo “Admin default page”;
    }

    p9939068

    February 15, 2008 at 2:25 pm

  7. Could the author please let me know what code changes are needed to achieve this integration? That would help me create codeigniter components for new releases. Or if there is a newer release please post a download link.

    Thanks.

    Corsair Moran

    April 12, 2008 at 1:49 am

  8. I’m currently working on an upgrade to this component which will support multiple applications and a hopefully a library that will make many features of the Joomla framework available to your Codeigniter apps.

    If anyone has great knowledge of the core of Joomla, I could use some assistance doing things like rendering the Joomla template from Codeigniter. Contact me at codeigniter4joomla–at–philmorris.net

    Phil Morris

    September 28, 2008 at 8:16 am

  9. Hi. I’ve been searching for something like this for weeks!
    I’ve sucessfully installed it, but I can’t figure out how to pass params to controller.
    eg.
    http://localhost/joomla/dev/index.php?option=com_ciexample&task=listcategory&param1=123&param2=xyz

    Some tip?

    Thanks a lot.

    Marcelo Oliveira

    October 10, 2008 at 1:04 pm

  10. Marcelo Oliveira try this:

    on routes.php

    $route['option=com_ciexample&task=([a-z]+)&Itemid=:num&Var=:num'] = 'ciexample/$1';

    on controller

    function test()
    {

    $id = $_REQUEST['Itemid'];
    $id2 = $_REQUEST['Var'];
    echo $id.$id2;

    }

    On Firefox test url
    index.php?option=com_ciexample&task=test&Itemid=3&Var=10

    Do’t forgot filter variable

    Powerslave

    January 29, 2009 at 3:00 am

  11. Hi all

    Does this work with Joomla in mod-rewrite mode for friendly urls?

    Thanks

    sluuger

    April 18, 2009 at 11:53 pm

  12. hi all!

    i am experimenting on using codeigniter within joomla. however, i ran into some problems when i used the pagination class when displaying the results of my query. when i want to go to the next page, i’m getting error in joomla. i think it has something to do with routing.

    p.s. i used the joomla wrapper to display my ci application in joomla.

    please help! thanks!

    cijom

    May 28, 2009 at 6:24 am

  13. Hi,
    do you solve the probleme with the uri.
    My application work fine in stand alone, but when i reach it by joomla, it seem that it can’t reach the dojo.js file… it seems that the path are not the same when i use the application alone and when i use it within joomla.. :(

    does any one have any solution ???
    thanks.

    Sergio

    September 11, 2009 at 7:31 am

  14. Looks a little hacky… Also I’m wondering if this works with the clean URL’s Joomla generates?

    This might be a project better tackled by creating libraries for CI to hook into the cookies / db of Joomla, without the code needing to be so integrated, and only having CI take up a subdirectory.

    Renowned Media

    October 27, 2009 at 8:23 am

  15. [...] 16. Codeigniter for Joomla [...]

  16. I work with Joomla and CI on a full time daily basis.

    Everything about this sounds like a bad idea.

    #1 If you want to use CI in a Joomla install just install it to its own directory. joomla.com/ci/
    from there if you want to use information from joomla just read from the database.

    #2 You want to use Joomla features such as login etc. Then use the Joomla framework! Joomla is a frame work it has everything CI has but it was made for Joomla.

    #3 Way to much overhead. Running two frameworks is going to really slow down your site, too many file reads, to many database connections.

    I really can’t see how anyone thinks this is a good idea, please explain.

    Nick Yeoman

    November 20, 2009 at 2:38 pm

  17. Codeigniter for Joomla …

    Yes, it is possible to use the excellent codeigniter framework on Joomla. In fact, I am surprised that it work pretty well with very little modification. The nightmares lies in the URI routing. Joomla uses the traditional uri query method while CI prom…

    frameworktutorials.com

    February 17, 2010 at 10:24 am

  18. link are dead..

    Ahmed

    April 13, 2010 at 7:03 am

  19. that link already dead.. please provide new

    Joe

    April 20, 2010 at 4:26 pm

  20. Please, provide new link… :(
    Thank You!

    Rob

    May 11, 2010 at 4:04 am

  21. [...] Codeigniter for Joomla [...]

  22. I am currently using CI with Joomla.

    Joomla is used for the front and backend, however, my usage of CodeIgniter is solely for te purpose of using it as a web crawler to store data for the Joomla site to use.

    This to me, seems like a perferct way to seperate out my particular application.

    I’m taking on new work all the time, so please feel free to contact me.

  23. Please, repost this archive. Even if it is outdated

    leverage

    September 8, 2010 at 2:37 pm

  24. Hi, I try to donwload the source code or CI + joomla but the url is not found.

    and should be more clear in explaination of the configuration of the Joomla component + Codeigniter.

    Thanks,

    Sopheap Neang

    September 12, 2010 at 3:16 pm

  25. It was lost when i move from my server to wordpress.com . Manage to dig it up and move it to my dropbox account. Have fun.

    azrulrhm

    September 26, 2010 at 1:34 pm

  26. hola tengo un pequeño problema io he creado un joomla con base de datos sql server2008 pero ahora kiero que mi codeigniter se implemente a mi joomla el que me pueda dar la solucion a mi correo le doy una copia de mi creacion con sqlsever ok espero me responda a mi correo

    luis mendoza

    February 6, 2011 at 7:58 am

  27. Thanks Azrul. I have been a paying customer of yours. As far as Joomla extensions go, you are with the elite at the top of the pack. Therefore, I was relieved when I saw your name with the extension. In fact, it was my memory of installing Zend Framework classes with Jomsocial which is why I had seeked to find this site in the first place.

    I experimented with your component and added some content where you had left off. I explained a couple of things; such as how to modify the Joomla template after Codeigniter is up and running inside of Joomla.

    The article is here:
    http://www.bohemiawebsites.com/Using-CodeIgniter-with-Joomla.html

    Kent Elchuk

    February 12, 2011 at 1:12 am

  28. A complete application for seamless integration of joomla and ci is here http://www.xavoc.com/index.php?option=com_rokdownloads&view=folder&Itemid=156&id=3:xcideveloper
    here you can not only develop components but also the Joomla modules, its seamless means use Ci or Joomla anywhere in any style…

    Gowrav Vishwakarma

    March 12, 2011 at 12:21 am


Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.