Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2010
    Location
    Florence, MS
    Posts
    486
    Thanks
    10
    Thanked 33 Times in 32 Posts

    File not finding Class

    Okay, so I have an initialize file that is in charge of including all of my classes.
    PHP Code:
    <?php
     
    // load config file first
     
    require_once('config.php');
     
     
    // load basic functions next so that everything after can use them
     
    require_once('functions.php');
     
     
    // load core objects 
     
    require_once('session.php');
     require_once(
    'database.php');
     require_once(
    'database_object.php');
     require_once(
    'logger.php');
     require_once(
    'pagination.php');
     require_once(
    'getter.php');
     require_once(
    "designatedPage.php");
     require_once(
    "newmenu.php");
     require_once(
    "phpmailer/class.smtp.php");
     require_once(
    "phpmailer/class.pop3.php");
     require_once(
    "phpmailer/class.phpmailer.php");
     require_once(
    "Smarty.class.php");
     require_once(
    "SmartyValidate.class.php");
     
     
    //load in database-type classes
     
    require_once('user.php');
     require_once(
    "subject.php");
     require_once(
    "keyword.php");
     require_once(
    "siteLevels.php");
     require_once(
    "hash.php");
     require_once(
    "siteMessage.php");
     require_once(
    "characterSheet.php");
     require_once(
    "photographs.php");
     require_once(
    "topic.php");
     require_once(
    "post.php");
     require_once(
    "postcomment.php");
    It has been going great, but then I get on my computer today and it says Fatal error: Class 'Post' not found in index.php
    I don't understand why it is suddenly doing this???? Any ideas???
    Last edited by Chris Hick; 08-17-2012 at 11:40 AM.
    Notice: If you post a problem and it gets fixed, please remember to go back and place it as solved. ;)
    I always recommend the HEAD First series of books for learning a new coding language. ^_^

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Since it worked before, something has changed with the structure or the file itself has been altered.

    Given the error itself, this would indicate overall that your error is that post.php no longer contains a definition for the class post. If the file couldn't be found, it will issue a fatal warning on the require, not on the on a call to new.

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,916
    Thanks
    15
    Thanked 227 Times in 227 Posts
    Class 'Post' not found in index.php

    Why is post capitalized in the error message?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by DrDOS View Post
    Class 'Post' not found in index.php

    Why is post capitalized in the error message?
    Class errors are dictated as typed. So if I type new POST, it would resolve the error indicating class POST doesn't exist.
    Classes like functions are case insensitive in PHP, but I'd strongly recommend that all filename paths to be lowercase (for a phar issue when loading via namespace and registered autoloaders).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •