Welcome Guest, Not a member yet? Register   Sign In
Dynamic Footer problem
#1

[eluser]iainco[/eluser]
Hey guys, currently making a project that is based on sports news, with users being able to rate articles and so on.

The footer for each page will display articles that users have archived, top rated articles, tags for the current sport and a little search form.

This footer is used on all pages.

The problem arises where users who have not registered visit a publicly accessible page - (for example the 'About' page)

Footer view code
Code:
<? if($this->session->userdata('email')): ?>
// Show content that registered users should see
<? endif; ?>

</div>
&lt;/body&gt;
&lt;/html&gt;


Code for making the footer content available.
Code:
function __construct()
    {
        parent::__construct();

        if($this->session->userdata('email'))
        {
            $this->load->model('FooterModel');
        }
    }
    
    function index()
    {
        $footerContent = array
        (
            'archived'     => $this->FooterModel->fetchArchived(),
            'tags'         => $this->FooterModel->fetchTags(),
            'topRated'     => $this->FooterModel->fetchTopRated()
        );        

        $this->load->view('common/header', array('title' => 'About'));
        $this->load->view('about/main');
        $this->load->view('common/footer', $footerContent);
    }

But it means I need to have this code on every page... and I just can't think of a better way to overcome this problem.

If I haven't explained the problem well please let me know and I will try to elaborate.

Thanks


Messages In This Thread
Dynamic Footer problem - by El Forum - 09-02-2008, 01:04 PM
Dynamic Footer problem - by El Forum - 09-02-2008, 04:28 PM
Dynamic Footer problem - by El Forum - 09-02-2008, 06:56 PM
Dynamic Footer problem - by El Forum - 09-02-2008, 07:34 PM
Dynamic Footer problem - by El Forum - 09-02-2008, 08:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB