This plugin has been extracted from the
NatSkinPlugin.
--
MichaelDaum - 21 Feb 2006
Thanks Michael for externalizing this Plugin and making it available to
TWikiCommunity!
How about measuring and documenting the
PluginBenchmarks numbers?
--
PeterThoeny - 22 Feb 2006
I
am seeing a degredation of performance in the Blog applciations now that it has been broken out into many plugins. I'll bee looking into the details when I have time to do a step-and-repeat test but right now it looks as if the
UserInfoPlugin is the one that's dragging things down.
--
AntonAylward - 23 Feb 2006
Anton, for a very long time now you keep talking like that but I haven't seen any numbers.
"Seeing a degradation of performance" is pure
FUD
. Stop that and get helpful. Btw if you've got
any report about the
UserInfoPlugin then put it on the
UserInfoPluginDev page.
--
MichaelDaum - 23 Feb 2006
I try to use following in the
WebLeftBar from the
PatternSkin, but the result is only a "1" instead of the included topic.
%IFDEFINED{"%CALC{"$SEARCH(http, %SCRIPTURL%)"}%" as="1" then="$percntINCLUDE{RudiRoseSandboxTest01}$percnt " }%
The included topic contains many html-code, so I can't use the %IF%-Statements.
The background is to show topic-content in subject to "http" or "https". Any Idea how to make it?
--
RudiRose - 28 Sep 2006
It looks like you run into an evaluation order issue, %IFDEFINED executes before %CALC. You should be able to do all with a %CALC. This here is untested:
%CALC{ "$IF($FIND(https, %SCRIPTURL%)==1, $NOP(%)INCLUDE{HttpsTopic}$NOP(%), $NOP(%)INCLUDE{HttpTopic}$NOP(%))" }%
--
PeterThoeny - 02 Oct 2006
Thank You for Your hint Peter. It's a pity, but the
SpreadSheetPlugin did'nt substitute the $percnt in %.
- Oh, I mixed it up with SEARCH. I fixed above example... -- PeterThoeny - 04 Oct 2006
--
RudiRose - 04 Oct 2006
Rudi, do you simply want to check the SCRIPTURL to start with "http" or "https" and do different things depending on it? If so then simply use
%IFDEFINED{"%SCRIPTURL%" as="^http:" then="..."}%
If you really need a TML expression inside the test then you can escape % the same way you did in the
then string already
%IFDEFINED{"$percntCALC{...}$percnt" ...}%
--
MichaelDaum - 03 Oct 2006
Thank's for Your prompt response Michael. I look only if SCRIPTURL start with "http:" or "https:" and so I use
%IFDEFINED{"%SCRIPTURL%" as="^http:" then="..."}%.
It's a pity but the regular expression in as="^http:" didn't work. The full string like "http://url/cgi-bin/" works correctly.
%IFDEFINED{"%SCRIPTURL%" as="http://url/cgi-bin/" then="..."}%.
--
RudiRose - 04 Oct 2006
The following works perfectly:
%IFDEFINED{"$percntCALC{"$SEARCH(http:, %SCRIPTURL%)"}$percnt" as="1" then="$percntINCLUDE{httpTopic}$percnt " }%
--
RudiRose - 05 Oct 2006
Try
%IFDEFINED{"%SCRIPTURL%" as="http:.*" then="..."}%.
This sample works too, thanx Michael --
RudiRose - 09 Oct 2006
--
MichaelDaum - 06 Oct 2006
Hi you all, as I am working on a couple of embedding includes for some hopeful nice featueres as
EmbedAddOn, I am always in doubt if I should use %IF% or %IFDEFINED%. Could you please give me a short hint, what's exactly the difference between this two functions. Wouldn't it be easier to extend the core %IF% and have only one function for this? Thanx for your help.
--
ThomasFreudenberg - 07 Oct 2006
Hi, I looked at the samples from
MichaelDaum and
RudiRose and my question is again to understand differences of builtin %IF{}% and plugin %IFDEFINED{}%. If the follwing samples are equal, so all what is better to
IfDefinedPlugin is the shorter way to write down the CALC content. Wouldn't it be the best and easiest to add a new optional parameter to "defined evaluation" of builtin IF like "defined VAR [regex]" ? I hope you understand my questions the right way, I am just asking, because I prefer to try to remove redundancy.
%IF{"%CALC{"$SEARCH("http:.*", %SCRIPTURL%)"}% > 0" then="..."}%
or
%IFDEFINED{"%SCRIPTURL%" as="http:.*" then="..."}%
or as new optional param
%IF{"defined SCRIPTURL as 'http:.*' then="%INCLUDE{httpTopic}%"}%
or as new operator "~=" as regex match or "!~=" regex not match [this is the one I would prefer]
%IF{"$ SCRIPTURL~='http:.*'" then="%INCLUDE{httpTopic}%"}%
--
ThomasFreudenberg - 09 Oct 2006
Micha, FYI:
KeithHelfrich added a small fix on the plugin topic.
--
PeterThoeny - 19 Dec 2006
I've just installed this plugin on a 4.1.0 system, since I'd love to have a closer look at the
NatSkin ... However, it seems that the code gets printed and not picked up and processed by the plugin. Would there potentially have been an installation step I may have missed?
--
AndersHolm - 26 Jan 2007
Did you enable the plugin in configure?
--
PeterThoeny - 26 Jan 2007
Peter, oh bugger. Ignore my previous comment. We use a deployment system. Was overwriting the prefs. All my bad.

Learning all kinds of interesting things on how to configure TWiki manually.
For the interested reader (read: newbies like myself) :
Edit twiki/lib/LocalSite.cfg
For each plugin do
$TWiki::cfg{Plugins}{NameOfPlugin}{Enabled} = 1;
Deploy as necessary .....
--
AndersHolm - 30 Jan 2007
I'm trying to replace a
%CALC{"$IF($EXISTS...
with IFEXISTS and failing. Am I doing something wrong?
This is working
%CALC{$IF($EXISTS(%WEB%.%INCLUDINGTOPIC%_InfoSpec), [[%WEB%.%INCLUDINGTOPIC%_InfoSpec]], \
$NOP(%)INCLUDE{"MediaOps.ProjectDetailButtonBuilder" \
pattern="^.*<\!-- BEGIN_BUTTON_1 -->(.*?)<\!-- END_BUTTON_1 -->.*"}$NOP(%))}%
This is not
%IFEXISTS( "%INCLUDINGTOPIC%_InfoSpec"
then = "[[%WEB%.%INCLUDINGTOPIC%_InfoSpec]]"
else = "%INCLUDE{"ProjectDetailButtonBuilder" pattern="^.*<\!-- BEGIN_BUTTON_1 -->(.*?)<\!-- END_BUTTON_1 -->.*"}%"
}%
--
VickiBrown - 10 Jul 2007
You prevented the expansion of the
INCLUDE in the else clause with
NOPs in the first example but not in the second one. Furthermore, the quotes of the arguments to
INCLUDE interfer with those from the
IFEXISTS.
Try
%IFEXISTS( "%INCLUDINGTOPIC%_InfoSpec"
then = "[[%WEB%.%INCLUDINGTOPIC%_InfoSpec]]"
else = "$percntINCLUDE{\"ProjectDetailButtonBuilder\" pattern=\"^.*<\!-- BEGIN_BUTTON_1 -->(.*?)<\!-- END_BUTTON_1 -->.*\"}$percnt"
}%
--
MichaelDaum - 10 Jul 2007
There is a bug in the installer script which means that it can't download the archive from twiki.org automatically. I reported the
bug
and attached a
patch (which shouldn't be attached here I guess).
--
MartinKaufmann - 05 Feb 2008
The installer script is generated automatically by the
BuildContrib based on the configuration settings of this plugin. Either these config settings are wrong or this is a bug in the
BuildContrib
--
MichaelDaum - 06 Feb 2008
I was just about to submit the same patch. Even if the installer was created by
BuildContrib, the maintainer should really manually apply the attached patch to
IfDefinedPlugin_installer because it may be confusing to new users when they are unable to install this plugin.
--
KavehAhmadian - 26 Apr 2008
In TWiki 4.2 I was getting a '0' or '1' returned in the topic where I used IFACCESS. I made these changes to sub handleIfAccess :
my $theThen = $params->{then} || '';
my $theElse = $params->{else} || '';
Logic seems to work ok now + i dont get the true/false output in the topic. not sure if this is a good hack or if it breaks something somewhere else.
--
AdamHyde - 01 May 2008
Yes, it does break a couple of applications that expect booleans. Your new default settings don't distinguish the output in the "then" result from the one produced in the "else" case by default. I don't think this is what you'd expect. Imho,
0 and
1 defaults for the
then and
else params are quite reasonable....
--
MichaelDaum - 02 May 2008