Trouble with system vars

#6
[eluser]steelaz[/eluser]
I assume you have variable $my_menu in views/wpMenu.php line 7.

In your controller, do this:
Code:
// Pass $my_menu var to wpMenu view and load it into $wpMenu_view var
$wpMenu_data['my_menu'] = 'My menu variable';
$wpMenu_view = $this->load->view('wpMenu', $wpMenu_data, true);

// Load more partial view here
$wpMeta_view = $this->load->view('wpMeta', $wpMeta_data, true);
$wpHeader_view = $this->load->view('wpHeader', $wpHeader_data, true);

// Load main view and pass partial views as variables (among other stuff)
$data['title'] = 'My Title';
$data['wpMenu'] = $wpMenu_view;
$data['wpMeta'] = $wpMeta_view;
$data['wpHeader'] = $wpHeader_view;
$this->load->view('template', $data);

In your main template:
Code:
<html>
<head>
    <title><?= $title; ?></title>
    <?= $wpMeta; ?>
</head>
<body>
    <?= $wpHeader; ?>
    <?= $wpMenu; ?>
</body>
</html>


Messages In This Thread
Trouble with system vars - by El Forum - 09-26-2009, 06:28 PM
Trouble with system vars - by El Forum - 09-26-2009, 06:31 PM
Trouble with system vars - by El Forum - 09-26-2009, 08:53 PM
Trouble with system vars - by El Forum - 09-27-2009, 05:11 AM
Trouble with system vars - by El Forum - 09-27-2009, 10:08 AM
Trouble with system vars - by El Forum - 09-27-2009, 12:14 PM
Trouble with system vars - by El Forum - 09-27-2009, 02:11 PM
Trouble with system vars - by El Forum - 09-27-2009, 03:34 PM
Trouble with system vars - by El Forum - 09-29-2009, 03:36 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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