Welcome Guest, Not a member yet? Register   Sign In
Just a few generalized questions
#1

[eluser]kaos78414[/eluser]
In an effort to better understand MVC structure, I have a few general questions.

Firstly, what is the difference between helper and library classes?

For instance: If I have a function or two that is used globally, should that be contained in a library?

Secondly, I have a certain code that checks session data for ACL related information. Should I put the if statement to return certain data in my view file, or in a function in a controller class ?

For instance, in the view I could have:
Code:
<?php if ($this->session->userdata('access_lvl') == 1) : ?>
<!-- Some code here -->
<?php else : ?>
<!-- Some different code here -->
<?php endif; ?>


Or should I have the controller call different view files for different cases like so:
Code:
function check_access_level() {
    if ($this->session->userdata('access_lvl') == 1) {
        $this->load->view('access1');
    else {
        $this->load->view('access2');
    }
}

Essentially both do the same thing right? So is there a reason I should be using one or the other? Or are both okay?


Messages In This Thread
Just a few generalized questions - by El Forum - 05-18-2010, 08:26 AM
Just a few generalized questions - by El Forum - 05-18-2010, 09:39 AM
Just a few generalized questions - by El Forum - 05-18-2010, 10:04 AM
Just a few generalized questions - by El Forum - 05-18-2010, 10:33 AM
Just a few generalized questions - by El Forum - 05-18-2010, 10:46 AM
Just a few generalized questions - by El Forum - 05-18-2010, 02:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB