title: Codeigniter passing objects within views
body: <p>I am loading a view from a Controller file and that View loads another view which a final one as below,</p>
  
  <pre><code>First view Call : 
  
      Controller: device.php
  
          public function device_name(){
             $data = new stdClass;
             $data-&gt;device_name = "Apple";
             $this-&gt;load-&gt;view('apple_device',$data);
          }
  
  Second view call :
  
      View: In apple_device.php
  
         $device_name-&gt;count = 123;
         $this-&gt;load-&gt;view('device_counts',$device_name);
  </code></pre>
  
  <p>I am using object here instead of an array as a passing variable between views. But if i use array, it works fine. </p>
  
  <p>And the above code throwing error as like below,</p>
  
  <pre><code>Message: Attempt to assign property of non-object
  </code></pre>
  
  <p>Any help would be appreciated.</p>