title: Possible Multi-Instanced Object Problem in PHP
body: <p>I'm getting a "Call to a member function process_data() on a non-object in page.class.php on line 35" even though the object has been called.</p>
  
  <p>Here is the index.php extraction showing the object being instantised</p>
  
  <pre><code>// require our common files
  require("modules/module.php");
  require("registry/objects/datetime.class.php");
  require("registry/objects/page.class.php");
  
  
  // load in all the objects
  $datetime = new dateandtime;
  $page = new page;
  $module = new module;
  </code></pre>
  
  <p>It then passes to the Process class</p>
  
  <pre><code>        require("template.class.php");
          $template = new template($php_path . "controllers/themes/adm/" . $page . ".html");
  
          // Place in both commonly used language and page specific language
          $template-&gt;language($php_path . "controllers/language/en/adm/common.php");
          $template-&gt;language($php_path . "controllers/language/en/adm/" . $page . ".php");
  
          // Tell the page's module to load in data it needs
          $module-&gt;process_data("module_" . $page);
  
          // Output the final result
          $template-&gt;output();
  </code></pre>
  
  <p>It's at this point PHP is throwing the error. The contents of the module.php file is as follows</p>
  
  <pre><code>class module {
  
      public function process_data ($child) {
          require($child . ".php");
          read_data();
          return true;
      }
  }
  </code></pre>
  
  <p>I've tried moving the instance declaration to within the second pasted code, but that generates more errors, because the class that "module" calls in then uses some of the "template" classes as well - so the same issue occurs just further down the line.</p>
  
  <p>What am I getting wrong her, or completely missing, I'm sure it's the latter but I really need help here. Thanks</p>