[cgiapp] Displaying LoggedIn or Login

adam at spatialsystems.org adam at spatialsystems.org
Sun Jan 13 23:22:33 EST 2008


I'm using HTML::Template and I have a block of HTML that will either display "Logged In" or "Not Logged In" based on if I'm logged in or not.

<div>
  <div>Logged In</div>
</div>

OR

<div>
  <div>Not Logged In</div>
</div>


How should I implement showing one of either block depending if I'm logged in?


My thought is to register a template callback to figure out if I'm logged in and pass HTML::Template a boolean for <TMPL_IF>


Something like this:
<TMPL_IF NAME="LOGGEDIN">
  <div>
    <div>Logged In</div>
  </div>
</TMPL_IF>

<TMPL_IF NAME="LOGGEDIN">
  <div>
    <div>Not Logged In</div>
  </div>
</TMPL_IF>


Does this sound right or is there a better way?

Thanks,
Adam


More information about the cgiapp mailing list