[eluser]Unknown[/eluser]
Hello!
I'm using CI Framework in order to build a web application as follows.
My default controller is something like this,
Code:
class Start extends CI_Controller {
public function index()
{
$view_data = array(
'foo' => 'bar',
'top_bar_view' => 'top_bar_view',
'top_bar_params' => array(
'param1' => 'val1',
'param2' => 'val2',
'param3' => 'val3',
'param4' => 'val4',
'param5' => 'val5'
)
);
$this->load->view('main_view', $view_data);
}
}
which loads the main_view, that is kind of master page, where I load the view file that I'm passing with $view_data.
Then, on this top_bar_view I would like to call a controller in order to build a menu depending on some data. For now, I accomplish this using an ajax call inside this partial view.
Code:
script type="text/javascript">
$(function() {
$.post('index.php/menu/givemenu', {}, function(data) { $('#topMenuBar').append(data); });
});
[removed]
<img alt="alt_data" src="assets/img/<?php echo $image_name; ?>" />
<div>
<img alt="<?php echo $descricao_editora; ?>" src="assets/img/<?php echo $image_name; ?>" />
</div>
<div class="divSpacer20pxRight">
</div>
<div class="divTituloProduto">
<?php echo $titulo_produto; ?>
</div>
<div class="clear">
</div>
<div id="topMenuBar" class="divTopMenuBar">
</div>
<div class="clear">
</div>
Is this correct and respects the MVC Framework?
How would you do it ?
Thanks in advance,