Welcome Guest, Not a member yet? Register   Sign In
is this ok in a view?
#4

[eluser]fesweb[/eluser]
Even better? Create a function in a/the model which checks the login status and writes the link.

This is probably horribly wrong to do...
Code:
function check_login() {
  if logged in
    $log_link = '<a href="logout">Logout</a>';
  else
    $log_link = '<a href="login">Login</a>';
  end if
  return $log_link;
}
...but you could do something like this instead...
Code:
function check_login() {
  if logged in
    $log_view = 'utilities/logout_link';
  else
    $log_view = 'utilities/login_link';
  end if
  return $log_view;
}
...then, in the controller(s)...
Code:
$this->load->view($this->your_model->check_login());
Either way, if the link or wording changes later, you just change it one in the one function or view.


Messages In This Thread
is this ok in a view? - by El Forum - 08-22-2008, 09:18 AM
is this ok in a view? - by El Forum - 08-22-2008, 10:20 AM
is this ok in a view? - by El Forum - 08-22-2008, 01:53 PM
is this ok in a view? - by El Forum - 08-22-2008, 02:28 PM
is this ok in a view? - by El Forum - 08-22-2008, 02:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB