Welcome Guest, Not a member yet? Register   Sign In
Disabling extraction in views
#1

[eluser]ralf57[/eluser]
Hi all,
is it possible to disable extraction of variables when passing data to the view?
Provided this scenario:

Code:
$data['a_heavy_dataset'] = $first_set;
$data['another_heavy_dataset'] = $second_set;
$data['the_third_heavy_dataset'] = $third_set;

$this->load->view('fisrt_view', $data);
$this->load->view('second_view', $data);
$this->load->view('third_view', $data);

why in the world would i have to pass the same heavy $data array to each and every view just to get it extracted once the view is loaded?
I know i could use

Code:
$this->load->file('view', $data);

but this would mean mix 'view' and 'file' and i don't want to do that.
I think that another parameter to disable "extraction" would be useful.
#2

[eluser]anggie[/eluser]
Try to passing data just ONE time, in one of the views...
#3

[eluser]ralf57[/eluser]
You're right anggie, but often it makes no sense to pass the $data array to have the keys extracted.
#4

[eluser]Henry Weismann[/eluser]
What about:



Code:
$first_data['a_heavy_dataset'] = $first_set;
$this->load->view('first_view', $first_data);

$second_data['another_heavy_dataset'] = $second_set;
$this->load->view('second_view', $second_data);

$third_data['the_third_heavy_dataset'] = $third_set;
$this->load->view('third_view', $third_data);


I'm not sure I fully understand the question but if I do that should solve the problem.




Theme © iAndrew 2016 - Forum software by © MyBB