I'm looking for peoples opinions on which way you do/would solve the following:
In the header you have either "Press here to login" or "Welcome xxxxxx".
Assuming I have all the information necessary (defined xsl variables and PAGE_SCOPE data) which of these options do you either use or think is better?
Options available:
1) Do not cache the component and do this:
<xsl:choose>
<xsl:when test="$loggedIn = 'true'">Welcome <xsl:value-of select="$name"/></xsl:when>
<xsl
therwise><xsl:call-template name="show-login-form"/></xsl
therwise>
</xsl:choose>
2) Cache the component and do this:
<div id="loginform" style="display:none"><xsl:call-template name="show-login-form"/></xsl:div>
<div id="welcomeTo" style="display:none"></div>
<script>
if ("$PAGE_SCOPE[loggedIn]" != "true") {
$("#loginform").show();
} else {
$("#welcomeTo").html("Welcome $PAGE_SCOPE[name]");
$("#welcomeTo").show();
}
</script>
3) Some other option that allows for the component to be cached.
My struggle is that I'm a fan of option #1 but that does not allow for the header to be cached which, IMO, is bad.