Developer forum

Forum » Templates » Check extranet user

Check extranet user


Reply
Hi!

I have an xslt template for a page that displays products in a certain group.

I want to display the "Buy"-button only if the user is logged in, but I have trouble determing this using xslt:if

This I have tried:

 

But this didn't work, the if case didn't return true even if I was logged in. So for testing I changed to this  

Those two if-cases are the opposite to each other, but none did return true.

Only when I removed the whole if-case it worked.

Best regards,

P


Replies

 
Nicolai Høeg Pedersen
Reply
A buy button would normally be in a ecommerce product list or product detail template and not the page template.

If you are in one of the product templates, the template tag you are checking does not exist...

Instead check on the global version of the extranet tags:
http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Global-template-tags/GlobalExtranet.UserName.aspx

 
Per Ljung
Reply
A buy button would normally be in a ecommerce product list or product detail template and not the page template.

If you are in one of the product templates, the template tag you are checking does not exist...

Instead check on the global version of the extranet tags:
http://templates.dynamicweb-cms.com/TemplateTags/Dynamicweb-template-tags/General-tags/Global-template-tags/GlobalExtranet.UserName.aspx

No, this doesn't work. There is no value when I write

xsl:value-of select="Global.Extranet.UserName" disable-output-escaping="yes"

even if I'm logged in.

And how do you check for an empty value in xslt? The statement if test="Global.Extranet.UserName= ''" also returns false, even when there's no value for the templage tag

Best regards,
P

 

You must be logged in to post in the forum