ajaxboy / cjax

Lightweight Ajax Framework built in PHP with no foot-print. Allows you to build ajax functionality with a single line of code & do so much more, right from the back-end!
http://cjax.sourceforge.net/
66 stars 27 forks source link

Responders and the CI framework #4

Open lordmatt opened 11 years ago

lordmatt commented 11 years ago

I have a whole load of models and other important business and database logic in the usual places in CI. Your CJAX thing is supposed to provide the existing framework with AJAX access right?

The way I have things set up currently - following your examples - is a folder called responses which has a file called login.php and a class called login all the logic for it is still in a model. Surely I would be better of using a controller?

In a response class I have no access to the Codeigniter framework which leaves CI mostly way out in the cold. So (1) CI is mostly pointless or (2) CJAX is just for pretty stuff but can't handle the heavy lifting of a real AJAX system or (3) you fully intended for CJAX and CI to work together and have been keeping this a secret.

So I do not have to spend the next two days reinventing the square wheel what is the process you intend or suggest to allow access to CI framework tools and helpers? At the moment response classes look more like really crap imitations of controllers.

Tell me I'm wrong but this really looks like it's been hacked onto CI in a way that ignores everything about CI that makes it worth using rather than designed to work within it.

ajaxboy commented 11 years ago

In your first question,

I apologize for any issues you may have experienced.

It would be reasonable to use an Ajax Controller if the way you are login-in is through AJAX, otherwise you should use your regular controller in the Controllers directory.

The main purpose of the separation is to maintain your ajax functionality in an organized way, away of all the misfits and clutter of code that other libraries/controllers and such may cause.

With that mentioned above, there is a way to route your Ajax Controllers to the same CodeIgniter controllers, but that would defeat the design purpose.

In your class inside response, you should have FULL access to the codeigniter framework. The examples included in the installation package provide at least 2 examples extending the existing CI Controller, that said there shouldn't be any problem using all your CI code inside your responses. It is designed to work as effective as the core CI functionality works.

And hate to say it but, yes you were wrong.