Welcome Guest, Not a member yet? Register   Sign In
echo statements rendering out of order with multiple views? CodeIgniter newbie
#1

[eluser]Unknown[/eluser]
Hi I'm new to codeigniter and I have been trying to to make a main controller and instantiate other controllers like a menu controller, and then display the views, but the output seems to go out of order. Mainly echo statements seem to come out first.
Anyone know why echo statements are rendered first?

In my main controller I have:

Code:
$this->load->view('header',$header);
    require_once('menu.php');
    $MainMenu = new Menu();
    $MainMenu->showMenu();

Here's the code for showMenu, where the echo statements are.

Code:
function showMenu(){
        
             echo "fun in the sun";
             $this->load->library('calendar');
             echo $this->calendar->generate(); echo seems to render wrong time
                        
            $menuItems['items'] =  this->menu_model->getMenuItems();        
            $this->load->view('menu_view',$menuItems);
            

            
        }

I thought I would get

header view
fun in the sun
calendar

menu view

instead I get:


fun in the sun
calendar

header view
menu view

the two echo statements output first even though they are called second.

Any help is appreciated.
Thanks so much.


Messages In This Thread
echo statements rendering out of order with multiple views? CodeIgniter newbie - by El Forum - 05-04-2009, 12:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB