Welcome Guest, Not a member yet? Register   Sign In
Passing dymanics data to the template
#1

[eluser]Coder Death[/eluser]
Hello to all,

How can I send dynamic data to my default template ?

this is the part of the template file
Code:
$template['default']['regions'] = array(
   'header' => array(
        'content' => array('  
             <div class="menu_list_home">
                Menu_1
                Menu_2
                Menu_3  
                Menu_4
             </div>
        '),
   'content' => array(
       'content' => array(
           '<div id="content_left">
                '.@$left_content.'
           </div>
          
           <div id="content_right" class="box-register_2">
              
                <font class="text_head">Registration form</font><br />

           </div>',
           )
   ),
   'footer' => ...
);
This code works without problem when I load the website, it loads as default page.
This is my view file
Code:
&lt;body class="dashboard"&gt;
        
        <div class="wrapper">

            &lt;?= $header ?&gt;

            <div id="content_">
                &lt;?= $content ?&gt;
            </div>
            
            <div id="footer">
            
                &lt;?= $footer ?&gt;
                
            </div>
        </div>
        
    &lt;/body&gt;
My problem is that I would like to load the same template with the same view when I click on any of the menu <i>Menu_1 ... Menu_4</i>
For this I create view files <i>menu_1.php </i> for example.
and in the controller I create a public function
Code:
public function menu_1 () {
     $data['left_content'] = 'Hello this is the menu_1';
     $data_=$this->load->view('menu_1',$data);
     $this->template->render();
}
Code:
left_content
has been placed in the template in the area where I want Menu_1 to be displayed.
Unfortunately, the page is loading the default one without displaying in the content area.

How can I solve this ?

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB