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

path to cjax.php #27

Closed oniwo closed 8 years ago

oniwo commented 8 years ago

I dont know why the Compiler is looking for 'cjax.php' in 'cjax/' instead of where it is in 'cjax/core/'. Please help. I am testing Version 6.0 beta 3. The error message is below.

A PHP Error was encountered

Severity: Compile Error

Message: require(): Failed opening required '/home/baba/lampstack-5.6.22-0/apache2/htdocs/examsystem/cjax/cjax.php' (include_path='.:/home/baba/lampstack-5.6.22-0/php/lib/php')

Filename: cjax/autoloader.php

Line Number: 40

Backtrace:

HallofFamer commented 8 years ago

Did you write a use statement? CJAX class is inside namespace CJAX\Core, so you have to import it by:

use CJAX\Core\CJAX;

Alternatively you can use the fully qualified name for CJAX class:

$ajax = \CJAX\Core\CJAX::getInstance();

Hope this helps.

oniwo commented 8 years ago

I had not written the use statement. I had no idea it was necessary. Just starting to get the hang of this namespace concept in PHP. Thank you so much, each of the two approaches work very well.