Ignited DataTables: Undefined property: Datatables::$like in Datatables.php on line 408

Ignited DataTables: Undefined property: Datatables::$like in Datatables.php on line 408

pansengtatpansengtat Posts: 66Questions: 26Answers: 1

This issue is pertaining to Ignited Datatables PHP Library (http://datatables.net/forums/discussion/5133/ignited-datatables-php-library/p1 and https://github.com/n1crack/IgnitedDatatables-php-library).

I have downloaded the master copy of Ignited DataTables, and am using XAMPP on Windows 8.1 x64. I already altered the database settings to match the credentials to my phpMyAdmin login, as well as imported the sample database 'sakila' from the MySQL website. I have also replaced instances of the CSS and JS files in the example index.php files to point to the CDN versions of the original DataTables JS and CSS files.

The issue is that the example files used could not initialize the instance of Ignited Datatables. The error message when debugging the JSON (using xDebug) is as follows:

Notice: Undefined property: Datatables::$like in C:\xampp\htdocs\IgnitedDatatables\Datatables.php on line 408
Call Stack

Time Memory Function Location

1 0.0043 157456 {main}( ) ..\ajax.php:0
2 0.0170 322376 Datatables->generate( ) ..\ajax.php:23
3 0.0258 323304 Datatables->produce_output( ) ..\Datatables.php:241
4 0.0563 325128 Datatables->get_total_results( ) ..\Datatables.php:347

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\IgnitedDatatables\Datatables.php on line 408
Call Stack

Time Memory Function Location

1 0.0043 157456 {main}( ) ..\ajax.php:0
2 0.0170 322376 Datatables->generate( ) ..\ajax.php:23
3 0.0258 323304 Datatables->produce_output( ) ..\Datatables.php:241
4 0.0563 325128 Datatables->get_total_results( ) ..\Datatables.php:347

I am not sure what I am missing; do I need to copy additional files to fix this, as I am anxious to use Ignited Datatables in conjunction with existing installation of Datatables?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,488Questions: 1Answers: 10,467 Site admin
    Answer ✓

    Might be best to open a github issue. I'm not sure if the author of IgnitedDataTables visits this forum often.

    Allan

  • pansengtatpansengtat Posts: 66Questions: 26Answers: 1
    edited October 2014

    For everyone who has encountered this or similar issue(s) on Ignited Datatables (PHP Library without CodeIgniter), there is an issue (open as of August 2014) at https://github.com/n1crack/IgnitedDatatables-php-library/issues/5 which reads:

    I have just downloaded IgnitedDatatables for native php and tested one of the examples (basic_init). It was not working and firebug showed this error.
    "Notice: Undefined property: Datatables::$like in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\BDNC\OBS\IgnitedDatatables\Datatables.php on line 408"
    When I commented lines 408 and 409 it was able to display the Datatable.

    So that means at the meantime, if you are using the CDN links to Datatables jQuery and CSS files (the URLs inside the example PHP files are super-outdated), a temporary fix is:

    • Go to file Datatables.php inside your extracted IgnitedDatatables folder

    • Comment out these lines:

          foreach($this->like as $key => $val)
            $this->ar->like($val[0], $val[1], $val[2]);
    
This discussion has been closed.