title: PHP Overloading, singleton instance
body: <p>I've sort of created my own MVC framework and am curious as to how other frameworks can send properties from the "controller" to the "view". Zend does something along the lines of <code>$this-&gt;view-&gt;name = 'value';</code> My code is:</p>
  
  <p>file: services_hosting.php</p>
  
  <pre><code>class services_hosting extends controller {
      function __construct($sMvcName) {
          parent::__construct($sMvcName);
  
          $this-&gt;setViewSettings();
      }
  
      public function setViewSettings() {        
          $p = new property;
          $p-&gt;banner = '/path/to/banners/home.jpg';
      }
  }
  </code></pre>
  
  <p>file: controller.php</p>
  
  <pre><code>class controller  {
      public $sMvcName = "home";
  
      function __construct($sMvcName) {
          if ($sMvcName) {
              $this-&gt;sMvcName = $sMvcName;
          }
  
          include('path/to/views/view.phtml');
      }
  
      public function renderContent() {
          include('path/to/views/'.$this-&gt;sMvcName.'.phtml');
      }
  }
  </code></pre>
  
  <p>file: property.php</p>
  
  <pre><code>class property {
  
      private $data = array();
      protected static $_instance = null;
  
      public static function getInstance() {
          if (null === self::$_instance) {
              self::$_instance = new self();
          }
  
          return self::$_instance;
      }
  
      public function __set($name, $value) {
          $this-&gt;data[$name] = $value;
      }
  
      public function __get($name) {
          if (array_key_exists($name, $this-&gt;data)) {
              return $this-&gt;data[$name];
          }
      }
  
      public function __isset($name) {
          return isset($this-&gt;data[$name]);
      }
  
      public function __unset($name) {
          unset($this-&gt;data[$name]);
      }
  
  }
  </code></pre>
  
  <p>In my services_hosting.phtml "view" file I have:</p>
  
  <pre><code>&lt;img src="&lt;?php echo $this-&gt;p-&gt;banner ?&gt;" /&gt;
  </code></pre>
  
  <p>This just does not work. Am I doing something fundamentally wrong or is my logic incorrect? I seem to be going round in circles at the moment. Any help would be very much appreciated.</p>