access array in views

I am trying to pass an array to the view of the very same controller. Here is my function
function show_menu(){
     $data['to_do_list']= array('Browse Jobs'=>'browse-jobs',
           'Browse companies'=>'browse-companies',
           'Job Types'=>'job-types',
           'Salary Range'=>'salary-range',

   echo "Show Menu";
How can I access this $data in recruitment/admin_menu.php

First, you need to pass it to your view.
$this->load->view('recruitment/admin_menu', $data);

Then, CI runs extract() on $data, so in your view, you would access it by using $to_do_list, which is your array. So in your view, if you did
<?php print_r($to_do_list); ?>
You should see it.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.