Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4053670
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:28:36+00:00 2026-05-20T14:28:36+00:00

I am following some examples in the PRO PHP AND JQUERY book, but for

  • 0

I am following some examples in the PRO PHP AND JQUERY book, but for some reason the examples doesn’t work. Even the examples that I downloaded from the books site doesn’t work. Not sure whats wrong, because I have done exactly as in the book..

/public/Index.php

include_once '../sys/core/init.inc.php';
$cal = new Calendar($dbo, "2010-01-01 12:00:00"); //ERROR Class 'Calendar' not found

/sys/core/init.inc.php

    function __autoload($class)
    {
        $filename = "../sys/class/class." . $class . ".inc.php";
        if ( file_exists($filename) )
        {
            include_once $filename;
        }
    }

/sys/class/class.calendar.inc.php

class Calendar extends DB_Connect
{
    private $_useDate;
    private $_m;
    private $_y;
    private $_daysInMonth;
    private $_startDay;

    /**
     * Create a database containg relevant info
     *
     * @param object $dbo a database object
     * @param string $useDate the date to build calender
     */

    public function __construct($dbo=NULL, $useDate=NULL)
    {
        /*
         * Call the parent constructor to check db object 
         */
        parent::__construct($dbo); 
    }


}

This is very annoying since every chapter in the books builds on this simple foundation. My guess is that __autoload() is the problem, but I have no idea..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:28:36+00:00Added an answer on May 20, 2026 at 2:28 pm

    The filepaths do not point to the right spots.

    A better idea would be something like this in Index.php…

    define('DOCROOT', dirname(__FILE__));
    

    …and then modify your __autoload() like so…

    function __autoload($class)
    {
        $filename = DOCROOT . "/sys/class/class." . strtolower($class) . ".inc.php";
        if ( file_exists($filename) )
        {
            include_once $filename;
        }
    }
    

    You should strotlower() the filename before including it, as your class is Calendar but your filename has calendar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am quite new to php but i have been following some tutorials
I've noticed some examples of things that work and don't work when dealing with
Today at work we came across the following code (some of you might recognize
What is the reason for the following warning in some C++ compilers? No newline
I was trying to follow some examples to use smart matching in the following
Following is some obviously-defective code for which I think the compiler should emit a
I have this .NET regex: ^(?<prefix>([^]*))\s(?<attrgroup>(\([^\)]*\)))\s(?<suffix>([^]*))$ It properly matches the following strings: some prefix
I'm considering the following: I have some data stream which I'd like to protect
I'm using the following to grab some updated HTML and insert it into a
I noticed for a while now the following syntax in some of our code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.