How to import celery.php as a library in CI?

29 views
Skip to first unread message

Hussain Tamboli

unread,
Dec 26, 2013, 9:05:48 AM12/26/13
to codei...@googlegroups.com
Hi,

I have written celeryclientlib.php and put that file and celery.php in CI's libraries.

A code snippet from this file -

-------------------------------------------------
    <?php
    class CeleryClientLib
    {
   
    function CeleryClientLib()
    {
        $this->load->library('celery');
    }
    ...
---------------------------------------------------
Now when I include celeryclientlib in one of my controller like -

    $this->load->library('celeryclientlib');

It is giving me error on the below line from celeryclientlib.php saying Undefined property

    $this->load->library('celery');

What seems to be the problem? How do I import celery.php? I certainly don't want to use require. Please help!

Ravi Dhoriya

unread,
Dec 26, 2013, 10:45:12 AM12/26/13
to hussaint...@gmail.com, codei...@googlegroups.com
Try this:

$ci=& get_instance();
$ci->load->library('celery');

Hope, it will work.. :)

Regards,
Ravi


--
You received this message because you are subscribed to the Google Groups "codeigniter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codeigniter...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
P  "Save a Tree" - Please consider the environment before printing this email.

Hussain Tamboli

unread,
Dec 27, 2013, 2:17:14 AM12/27/13
to codei...@googlegroups.com, hussaint...@gmail.com
Hi Ravi,

Thanks for the reply.

It's not working.

It gives errors saying -
   1.
   Missing argument 1 for Celery::__construct()

   Filename: libraries/celery.php

   Line Number: 64

    2.

   Missing argument 2 for Celery::__construct()

   Filename: libraries/celery.php

   Line Number: 64

and so on.

---------------------------------

celery.php contains some classes. This brings me to another question - Can a CI library have more than 1 classess in it?

Hussain Tamboli

unread,
Dec 27, 2013, 5:11:10 AM12/27/13
to codei...@googlegroups.com, hussaint...@gmail.com
Reply all
Reply to author
Forward
0 new messages