Welcome Guest, Not a member yet? Register   Sign In
Output Class Question
#1

[eluser]wdcmatt[/eluser]
I have read the user guide and I am a bit unclear on how to do something or if it can be done (within the framework).

I've noticed that in a controller code igniter waits till my controller is finished (with all its functions and view calls) before displaying the page. This makes sense... but under some circumstances I do not want to get to the end of a function how would I go about doing this, I will provide an example:

Code:
class sample extends Controller
{
    function sample()
    {
        parent::Controller();
    }

    function display_page($id)
    {
        $this->load->model('mpage');    // my model to get the data from the db

        // skipping all validation for demo purposes

        $pageData = $this->mpage->get_page($id);  // returns associative array of page data...

        // Check to see if the page is allowed to be viewed publicly...
        if ( ! $pageData['content_published'])
        {
            //output the notification that content not published.
            $this->load->view('not_published.php');  
            // End here... some how...? and display output normally
        }

        // Check to see if the content has expired (content scheduling...)
        // this would normally involve dates and times... but for demo assume a bool answer
        if ( $pageData['expired'] )
        {
           // notify the user that the content has expired.
           $this->load->view('content_expired.php');
           // End here some how???? and display output normally
        }

        // if they made it through everything do something else...
        $this->load->view('show_page.php', $pageData);
    } // End display_page
}

I know some of you are already thinking of ways to rewrite the sample so that I don't have to terminate in the middle of a function... I know how to do that already. What I'm looking for is a way to end in the middle of a function and still display the output as usual. The project I'm working on is actually much more in depth and would be much much easier for me to perform that type of function.

Is there a way to do this? Can someone give me an example usage?


Messages In This Thread
Output Class Question - by El Forum - 03-11-2010, 09:19 AM
Output Class Question - by El Forum - 03-11-2010, 09:32 AM
Output Class Question - by El Forum - 03-11-2010, 09:57 AM
Output Class Question - by El Forum - 03-29-2010, 02:08 PM
Output Class Question - by El Forum - 03-29-2010, 02:13 PM
Output Class Question - by El Forum - 03-29-2010, 03:16 PM
Output Class Question - by El Forum - 03-29-2010, 03:22 PM
Output Class Question - by El Forum - 03-29-2010, 03:50 PM
Output Class Question - by El Forum - 03-30-2010, 12:42 AM
Output Class Question - by El Forum - 03-30-2010, 06:23 AM
Output Class Question - by El Forum - 03-30-2010, 06:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB