Re: Best way to check if a user is logged in

Christian Stocker <[email protected]> Tue, 07 Feb 2006 00:53:40 +0100
Newsgroups gmane.comp.cms.bitflux.general
Organization Bitflux GmbH
Message-ID <[email protected]>
Hi

It really depends how big the DOM tree will be, for simple stuff, we use
your second approach, but if the DOM tree really differs, then you
should go with the first one.

HTH :)

chregu

On 6.2.2006 22:48 Uhr, Alain Petignat wrote:
> 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.
> 

-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [email protected] |  GPG 0x5CE1DECB
-- 
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms