CodeIgniter Forums

Full Version: cjax framework codeigniter 3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I installed cjax framework and the initial test suggested after installation worked. But when I tried to run my first test by copying democode into an existing view webpage and into an existing controller it crashed with
Code:
Message: Non-static method plugin::initiatePlugins() should not be called statically, assuming $this from incompatible context

Filename: classes/core.class.php

Line Number: 672

Here is the code I included according to installation request

Code:
<?php

//core file, reference..
require_once "ajax.php";
//initiate CJAX..
$ajax = ajax();

//                                /controllers/search.php:string()

?>
<head>
<?php echo $ajax->init();?>
</head>

I noticed that "ajax.php' is in the root directory of my application.

Has anybody experience with the initial setup of cjax. It seems so promising.

Thank you.
I noticed I did not use the Codeigniter install version. I did that now. But it is still not working. Does anybody have experience who can give me help in the initial setup so I can get started.
Thank you for your help! I need a controller sample and view sample that works. Does it work with codeigniter 3?
I don't understand why such a framework even exists. With jQuery, doing ajax call is trivial.
@ includebeer Not offense. Sir. but your staments sound so very dumb. Is like saying, why use firefor of chrome when you have IE or why Use Safari or Chrome when you have firefox, or why use a PHP Framework when you can just write PHP?.

Cjax and Jquery although they both can do ajax request, they are not exclusive to each other, Cjax actually works well with Jquery, and there are some Cjax plugins that use jQuery. you obviously don't know what you are talking about, but I'll pass it as ignorance.

I will give you an example.
1.
$ajax->call(string $url);

Jquery:

$.get( string url);

2.

$ajax->click('#element_id', $ajax->call(string $url, string $container));

jQuery('#element_id').on('click', function(response) {

$(string container).html(response);
});


There are two small examples how they do similar things. But Cjax is much more than a 'trivial' JavaScript library. It allows you to use CodeIgnater Controllers like so

Class Test extends CI_Controller {

public test function()
{

$ajax = ajax();

$ajax->success('You performed an action!!');

}

}

I will tell you what the small piece of code above does.
It is an ajax controller, it organizes all your ajax controllers in a directory called response in your CI application directory, familiar with a controller?

Notice I didn't have to include any files, or load anything? that is the ajax dispatcher at work.

To accomplish the above with jQuery, you have to install an additional plugin, or spend at least a few hours coding a nice work flow to display a looking messaging display system.

That is one of the smallest examples, you can also do:

$ajax->overlay($url)

and load and entire page, on a dropbox.

$ajax->click('#element_id', $ajax->overlayContent('Provide data directly! without a url'));

.. and Cjax goes on and on..

$ajax->wait(5);

$ajax->alert('Hello!');

$ajax->upload(); (http://cjax.sourceforge.net/examples/plu...loader.php)

yup you can easily upload files, using cjax.


There is one main thing where cjax differ to any other library, it relies on the server, so you can do powerful things from the server side. Simple. Clean Api.

Now here is an example, how cjax can work with jQuery:

$ajax->click('.any', $ajax->info('Information message'));

Yup Cjax can use jQuery selector engine (or not), it does not require it and still operate just fine by using the same selector engine jQuery uses (Sizzle) , which comes included with Cjax.

Cjax's ajax controllers can also recognizes requests made by jQuery, you will be able to further use $ajax code on the backend, even if you used jQuery to make the ajax requests.

So, I could go on and on and on, on many thing more how Cjax and jQuery aren't exclusive to each other. And how you can use both, and here is the kicker, you can use cjax without using jQuery. You can use simple synxtax to communite with the back end, and you can communicate with the front end too!, yup cjax lets you communite not only from the front end to the back it, but also the way around!.

Cjax also offers basic documentation
http://cjax.sourceforge.net/docs/
and 50+ examples of how you can use cjax: http://cjax.sourceforge.net/examples/

with cjax, you can do so much with so little, and no need to include any JS!. Most ajax functionality API
is only one line of code.

And one of the main things that cjax takes pride on is that all your code is hidden, you won't see a line of code of the front it, and you don't need to add anything to items being interacted with.

well I could go and and on and on, but if you think cjax and jQuery are then same thing there for cjax is irrelevant, I respect your opinion.