• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
From within a view, how to see all variables passed into it from controller?

#1
[eluser]inktri[/eluser]
Quote:
Code:
<?php
//master view - index.php
$this->load->view('header');
$this->load->view($page);
$this->load->view('footer');
?>
And then from my controller

Code:
$this->data['page'] = 'somepage';
$this->load->view('index', $this->data);
[/code]

I'm using the method above to handle headers and footers; however I can't think of a clean way to handle passing data into the 'somepage' view. From within the 'master view', what's the array that holds all data that's passed into it?

For example if I were to do:
Quote:
Code:
<?php
//master view - index.php
$this->load->view('header');
$this->load->view($page, $xxxxxxxxx);
$this->load->view('footer');
?>
And then from my controller

Code:
$this->data['page'] = 'somepage';
$this->data['data1'] = 'bob';
$this->load->view('index', $this->data);
[/code]

How would I pass the data1 piece of data to the 'page' view (through the 'master view')? I need to handle the general case... so from the point of view of the 'master view' I don't know how many or what variables will be passed in to me

Thanks for the help

#2
[eluser]sophistry[/eluser]
i think you are looking for $this->load->vars() . see the user guide for details. basically, it loads variables into a kind of "global" scope for all views.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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