php - codeigniter : pass data to a view included in a view -
i have controller , including 2 views 1 function below
$this->load->view('includes/header',$data); $this->load->view('view_destinations',$data);
the view file view_destinations.php
including php menu file follows
<? $this->load->view('includes/top_menu'); ?>
my question is, how can pass data fetched controller included top_menu.php
?
thank guys
inside controller, have
$data['nestedview']['otherdata'] = 'testing';
before view includes.
when call
$this->load->view('view_destinations',$data);
the view_destinations
file going have
$nestedview['otherdata'];
which can @ point, pass nested view file.
<? $this->load->view('includes/top_menu', $nestedview); ?>
and inside top_menu file should have $otherdata
containing 'testing'.
Comments
Post a Comment