object persistence within a session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If this is the wrong forum, please point me at the correct forum.

I am new to PHP but have 40 years experience programming.

My initial effort includes a class definition which needs to persist for the duration of a WWW session.  The code (this snippet is the beginning of Default.php)

  <?PHP
   session_start();
   require_once 'CSSFrames_Includes/Classes.inc';
   if (!isset($_SESSION["navigator"]))
    {
    $_SESSION["navigator"] = new CSSFrames_Navigator;
    }
   else
    {
    parse_str($_SERVER['QUERY_STRING'], $queryString);
    foreach ($queryString as $key => $value)
     {
     switch($key)
      {
      case "ID":
       $_SESSION["navigator"]->set_page_ID($value);
       break;
      default:
       break;
      }
     }
    }
initially works ... $_session["navigator"] does exist and methods do function correctly.  When, however, I click a link and cause the script (Default.php) to be reentered, I get the following

Fatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;MyClass_defined&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /MyWebSite.com/Default.php on line 16

which I understand to mean that my class definition (file?) has not been loaded.  What I do not understand is why has not the class definition been loaded?  Did storing the object reference not also store the class definition?  What must I do to retain the class definition as part of the session data?

Thanks,
Stan  

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux