Codeigniter View and Echo

I have a function that handles the sidebar of a webpage in codeigniter.

in the following way:

function process_sidebar()
{
$this->load->view("first_access"); // ------------(1)
$this->load->view("second_access");// --------------(2)
echo "Here i want to show some data after loading view second_access"; //pls note here --(3)

$this->load->view("third_access"); // --------------------(4)
$this->load->view("fourth_access"); //-------------------------(5)

}

Please check the order numbers, but the problem is that codeigniter is not up to order.

This is the display of the latter and the display of the part echo.

how can i overcome this?

Thank.

+5
source share
2 answers

You want append_output()instead of echo:

<?php
function process_sidebar()
{
    $this->load->view("first_access"); // ------------(1)
    $this->load->view("second_access");// --------------(2)
    $this->output->append_output("Here i want to show some data after loading view second_access"); //pls note here --(3)
    $this->load->view("third_access"); // --------------------(4)
    $this->load->view("fourth_access"); //-------------------------(5)
}
+10
source

, CodeIgniter, , . , , , , . 2- 3- .

0

All Articles