Welcome Guest, Not a member yet? Register   Sign In
Undefined Variable when using Views
#1

[eluser]Brandon Beasley[/eluser]
Home Controller

Code:
<?php

class Home extends Controller {

    function Home(){
    
        parent::Controller();    
    }
    
    public function index()
    {
        
        $data = new stdClass();  // WORKING
        
              $data->trends = $this->twitter->search('trends'); // WORKING
        
        
        // print_r($data);
        
        $this->load->view('trends_view', $data);

The results of print_r when executed on Home is displaying the object, but the View is not getting the $data variable passed to it.

trends_view View
Code:
<?php print_r($data); ?>

This is what is returned:

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: data

Filename: views/trends_view.php


This is my first post, go easy on me Smile


Messages In This Thread
Undefined Variable when using Views - by El Forum - 01-19-2010, 12:02 PM
Undefined Variable when using Views - by El Forum - 01-19-2010, 12:08 PM
Undefined Variable when using Views - by El Forum - 01-19-2010, 12:17 PM
Undefined Variable when using Views - by El Forum - 01-19-2010, 12:57 PM
Undefined Variable when using Views - by El Forum - 01-19-2010, 01:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB