Best way to check if a user is logged in
Alain Petignat <[email protected]> Mon, 06 Feb 2006 22:48:06 +0100
| Newsgroups | gmane.comp.cms.bitflux.general |
|---|---|
| Message-ID | <[email protected]> |
Hi
i want to give a different result either if a user is logged in or not.
it is not very sensitive information, i just want to display a little
icon and link to the editor for that entry.
There are at least two different ways to handle this:
1. check within the plugin itself and return a different dom:
in _construct:
$perm = bx_permm::getInstance();
if($perm->isLoggedIn()){
$this->isLoggedIn = true;
}
2. return the whole dom-tree and check within xsl to display the icons:
add php to namespace:
xmlns:php="http://php.net/xsl"
set the variable $username:
<xsl:variable name="username"><xsl:value-of
select="php:functionString('bx_helpers_perm::getUsername')"/></xsl:variable>
check on the template:
<xsl:choose>
<xsl:when test="$username != ''">
<a href="{...}"><img src="myfunkyediticon.png" /></a>
</xsl:when>
<xsl:otherwise>
which way do you consider smarter or more performant?
Thanks
Alain.
--
________________________________________________________________________
www.sequenz.ch
--
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms