[eluser]Kraig[/eluser]
This is my errior - Message: Undefined variable: user_info
On my home page I have a Views template that looks like this:
Code:
<?php $this->load->view('includes/header'); ?>
<?php $this->load->view('includes/topMembers'); ?>
<?php $this->load->view('includes/news'); ?>
<?php $this->load->view($main_content); ?>
<?php $this->load->view('includes/footer'); ?>
Now I'm trying to figure out how to create a topMembers controller that way I can load a model and get some topMembers information. Keep in mind that the topMember view is loaded onto my home page. I do have a topMembers controller, but for some reason when I "reload" the topMembers view with a variable it is not working. Am I going about this wrong? Here's my topMembers controller
Code:
class TopMembers extends CI_Controller {
function index()
{
// Grabbing all the files associated with the current user
$this->load->model("membership_model");
$q = $this->membership_model->user_info();
$data['user_info'] = $q;
$this->load->view('includes/topMembers', $data);
}
}
And here is my topMembers View
Code:
<?php
$user = array();
foreach ($user_info as $value)
{
$user[] = $value['first_name'];
}
?>
//HTML below