Editor: Uncaught Error: Class 'DataTables\\Editor' not found in .... (path)

Editor: Uncaught Error: Class 'DataTables\\Editor' not found in .... (path)

TonyRTonyR Posts: 27Questions: 6Answers: 0

I had this problem before, caught a simple pathing mistake, and moved on. Now I am having the issue again (new project) and I can't figure out what's going on. My pathing in this case is absolutely unmistakable. Can I please get input from somebody on just exactly what this error means, and what it may be missing? The actual error is:

[Sun Jun 24 20:27:37.777171 2018] [php7:error] [pid 9087] [client ::1:60433] PHP Fatal error: Uncaught Error: Class 'DataTables\Editor' not found in /Library/WebServer/Documents/boa/boa_data.php:15\nStack trace:\n#0 {main}\n thrown in /Library/WebServer/Documents/boa/boa_data.php on line 15, referer: http://localhost/boa/index.php

boa is my site. I moved boa_data.php from the php directory to the site root, and within that:

<?php
// DataTables PHP library
include("php/DataTables.php");

use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\MJoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;
 
Editor::inst( $db, 'boa2' )
->fields(
    Field::inst( 'Posted_Date' ),
    Field::inst( 'Payee' ),
    Field::inst( 'Address' ),
    Field::inst( 'Amount' )
)
->process($_POST)
->json();

I am referencing DataTables.php in its own php directory. It is unmistakable that the file named DataTables.php exists within /Library/Webserver/documents/boa/php.

To start this project, I basically copied all the php, js, and css stuff over to the new site, and made modifications where necessary (like setting the database in config.php).

Am I mistakenly using the free yet timebombed version of Editor? The error is at precisely line 15: Editor::inst($db, 'boa2').

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    The problem isn't that DataTables.php can't be found, its that Editor/Editor.php can't be found (from the same root path as the DataTables.php file - so it should be php/Editor/Editor.php.

    The PHP code isn't obfuscated in the trial or licensed version - there is no difference between them.

    Allan

  • TonyRTonyR Posts: 27Questions: 6Answers: 0

    Thanks, Allan; good info. I will look into that.

  • TonyRTonyR Posts: 27Questions: 6Answers: 0

    Got it. I for some reason failed to copy 'bootstrap.php' into the php directory of my site. Thanks again, Allan.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    That would do it - thanks for letting me know! I'll add a check into the code for that file.

    Allan

This discussion has been closed.