Tags:
create new tag
, view all tags

Question

Does anyone have successful method for displaying skin template elements based on some conditional factor such as whether the user is signed in?

I've been trying to achieve this for some time without success. Specifically, I want to display the topic actions only when a user is signed in.

I've tried to insert conditional statements in template files using the conditional features in both SpreadSheetPlugin and SessionPlugin. In both cases, using %INCLUDE as one of the options breaks the conditional code.

Has anyone had success with something like this?

Environment

TWiki version: TWikiAlphaRelease
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux
Web server: Apache
Perl version: 5 something
Client OS:  
Web Browser:  
Categories: Authentication, Skin

-- LynnwoodBrown - 14 Jul 2005

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Escape the INCLUDE, as in %CALC{ ... $NOP(%)INCLUDE{...}$NOP(%) ... }%

-- PeterThoeny - 15 Jul 2005

Thanks, Peter! That did the trick. For future readers, here's the complete conditional statement I'm using as as example:

%CALC{"$IF($EXACT(%USERNAME%,guest), ,$NOP(%)INCLUDE{TWiki.ToolBar}$NOP(%))"}%

-- LynnwoodBrown - 15 Jul 2005

Well, I thought I had it all figured out because this method worked for including a topic into a template. However, I can't seen to get it to work with including other template elements (e.g. %TMPL:P{"toolbar"}%) - which would probably be the most common use. Anyone have ideas why this isn't working?

-- LynnwoodBrown - 16 Jul 2005

This does not work because the templates are expanded before the internal variables and Plugin variables. It sounds like a useful enhancement though to parse %TMPL:... templates one more time after the Plugins.

-- PeterThoeny - 16 Jul 2005

In the upcoming DakarRelease, there's a new feature in templates called "context identifiers." It seems to me that this might a suitable mechanism to achieve what I'm after here. Perhaps someone who's familiar with that feature could comment on possibility of adding a "logged-in" context identifier.

-- LynnwoodBrown - 18 Jul 2005

I want to hide the left bar in the page of the site twiki. How I make this?

-- AndreMatos - 10 Apr 2007

See PatternSkinCustomization.

-- ArthurClemens - 10 Apr 2007

 
Topic revision: r8 - 2007-04-10 - ArthurClemens
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.