[eluser]TriCityGuy[/eluser]
[quote author="techgnome" date="1287443857"]I put mine into a library... then the library is autoloaded... in the view I can then do
Code:
if($this->myLib->am_I_logged_in()) { echo "I'm Loggin!"; } else {echo "Youuuu shall not PASSS!"; }
Actually in reality, I've actually factored even that logic out into my library method so that conditional isn't in the view at all:
Code:
//In the library
function get_admin_link() {
if($this->am_I_logged_in() && $this->am_I_admin()) {
return anchor('site/admin');
} else {
return ""; // Not logged in and not an admin -- no link
}
.
.
.
// In the View:
<?php echo $this->MyLib->get_admin_link(); ?>
Now my view doesn't care how I get the login info... even better, if I decide later I want to change how I validate the user (which I have actually done three times already), I update the library - the view remains unchanged and unaware of the change.
-tg[/quote]
This is right along the lines of what I was looking for. Thanks!