title: PHP Accessing parent class on an include file
body: <p>A NEW UPDATE ON THE PROBLEM</p>
  
  <p>I wan't the class 'BlogPost' to access its parent class variables that have been set on the main.php page</p>
  
  <pre><code>class BlogPage {
      public $PageExists = false;
      public $PageTitle = "no title";
      public $PageId = "0";
      function __construct($page){
          //some sql to check if page exists
          if($page_exists){
              $this-&gt;PageExists = true;
              $this-&gt;PageTitle = $fetched['row_title'];
              $this-&gt;PageId = $fetched['row_id'];
  
          }
      }
  }
  
  class BlogPost extends BlogPage {
      function __construct(){
          $page_id = $this-&gt;PageId;
          //some sql to get the posts that have post_page like $page_id
      }
  }
  </code></pre>
  
  <p>The Main.php page</p>
  
  <pre><code>$page = new BlogPage("index");
  if($page-&gt;PageExists == true){
      include("posts.php");
  }else{
  include("notfound.php");
  }
  </code></pre>
  
  <p>The posts.php</p>
  
  <pre><code>$pageTitle = $page-&gt;PageTitle;
  $posts = new BlogPost();
  </code></pre>
  
  <p>?></p>