[eluser]piehouserat[/eluser]
Ah I didn't think about that because I thought all logic like that was done in the controller? Well my controller now looks like this:
Code:
function index()
{
$header_data['page_title'] = 'Home';
if (!$this->tank_auth->is_logged_in()) {
$this->load->view('includes/header', $header_data);
} else {
$header_data['user_id'] = $this->tank_auth->get_user_id();
$header_data['username'] = $this->tank_auth->get_username();
$this->load->view('includes/header', $header_data);
}
$footer_data['copy_year'] = date('Y');
$this->load->view('includes/footer', $footer_data);
}
and I've modified my header view to contain this:
Code:
...
<ul id="nav">
<?php
if (!$this->tank_auth->is_logged_in()) {
?>
<li id="t-signin">
<?php echo anchor('/auth/login/', 'Sign in'); ?>
</li>
<?php
} else {
?>
<li id="t-profile">
<a href="/<?php echo $username; ?>" class="url" rel="contact">You</a>
<ul class="tabs">
<li><?php echo anchor('/' . $username, 'Your profile'); ?></li>
<li><?php echo anchor('/account', 'Your account'); ?></li>
<li><?php echo anchor('/auth/logout/', 'Sign out'); ?></li>
</ul>
</li>
<?php
}
?>
...
And this all works well

But is this good MVC architecture? I thought all application logic was meant to be kept out of the view and in the controller?
Thanks again