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
--
LynnwoodBrown - 14 Jul 2005
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is 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