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 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

About these ads

41 thoughts on “Codeigniter for Joomla

  1. 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?

  2. 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”;
    }

  3. 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.

  4. 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

  5. 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

  6. 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!

  7. 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.

  8. 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.

  9. Pingback: 40+ CodeIgniter Framework Tutorials for Kick-Ass PHP Application | Son Of Byte

  10. 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.

  11. Pingback: frameworktutorials.com

  12. Pingback: Blog's Dac Diep Vuong » Blog Archive » 30 Top Codeigniter best Tutorials You must want to know

  13. Pingback: 30 Top Codeigniter best Tutorials You must want to know. | 99Points

  14. 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.

  15. Pingback: Logicationz Tech surat codeigniter developer,website development surat,surat website design,codeigniter development india,php developer surat,wordpress developer,joomla developer » Blog Archive » 30 Top Codeigniter best Tutorials You must want

  16. 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

  17. 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

  18. Great blog here! Also your website loads up fast! What host are
    you using? Can I get your affiliate link to your host?
    I wish my web site loaded up as fast as yours lol

  19. I just wanted to send a small remark in order to appreciate you for all of
    the fabulous tactics you are giving out on this website.
    My rather long internet investigation has finally been honored with brilliant facts and techniques
    to talk about with my family. I ‘d claim that many of us site
    visitors actually are very much endowed to exist in a decent community with very many lovely people with beneficial
    tips and hints. I feel rather lucky to have come across your entire weblog and look forward to some more entertaining moments reading here.
    Thank you once again for everything.

  20. Great article. It’s very unfortunate that over the last several years, the travel industry has had to handle terrorism, SARS, tsunamis, bird flu, swine flu,
    and the first ever entire global downturn. Through everything the industry has proven to be effective, resilient plus dynamic,
    acquiring new approaches to deal with adversity. There are continually fresh difficulties and opportunities to which
    the sector must just as before adapt and respond.

  21. I believe what you published made a bunch of sense. But, what about this?
    what if you composed a catchier post title? I am not
    saying your content isn’t good, but suppose you added a post title
    that makees people desirre more? I mean Codeigniter forr Joomla | the
    best site on planet earth is a little boring. You ought to look at Yahoo’s home
    page and watch how they create article titles to grab viewers to open the links.
    You might try adding a video or a pic or ttwo to get
    readers interested about what you’ve got to say. In my
    opinion, it could make your blog a little livelier.

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s