Fatal Error Class not found

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

12-Feb-12 11:15
Hi,
I have recently purchased the Mastering Web Apps book and have been working through the examples and I am currently trying to modify and expand the ToDo example in particular.

As part of that process I have created a class timesheet and added the necessary 'require' statement however, when I log in the redirect issues the following error message:

Fatal error: Class 'timesheet' not found in D:\wamp\www\tango\index.php on line 454

Here is the function in question:


function listTimesheet() {
$results = array();
$results['timesheets'] = timesheet::getListForUser( user::getLoggedInUser() );
require( TEMPLATE_PATH . "/listTimesheet.php" );
}


I have been going round in circles on this one and as a novice do not know what other significant pieces to add to this for clarity. I would greatly appreciate some input on this issue.

Best Regards

Chris
17-Feb-12 03:02
Hi Chris,

Thanks for purchasing the book

It's tricky to pinpoint the problem without seeing your entire code. Couple of things to check:

1) Are you putting the require statement in the file that contains your listTimesheet() function, or at least in a file that that file includes?

2) Watch the case of your class name: 'timesheet' is not the same thing as 'Timesheet' (as far as I can remember with PHP).

3) Make sure you've actually named your class 'timesheet'/'Timesheet' in your class file. Also check for typos in the class name.

Does any of that help?

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/

 
New posts
Old posts

Follow Elated