• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading a div in view.

while loading a view is it possible to load only a small part of a page.
Say i have a template page that contains 5 div's and i just want to load a single div(id=xyz).

In my controller i like to do something like this

public function index()
$this->load->view(<div id=xyz>);

hi peace you have to do some thing like this.

public function index()
       $data['div1'] = '<div id="xyz">';
        $data['div2'] = '<div id="xyz">';
        $data['div3'] = '<div id="xyz">';

&lt;? echo $div1?&gt;
&lt;? echo $div2?&gt;
&lt;? echo $div3?&gt;

its will work fine. you have to pass array of variables to view. check user guide also.

[eluser]Colin Williams[/eluser]
Or, fetch a smaller view and send it to the main one

$data['part'] = $this->load->view('part', '', TRUE);
// Use TRUE to capture result and not render it

$this->load->view('page', $data);
// There is now a $part var in the page.php view the holds the rendered contents of the part.php view

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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