[pmwiki-users] Nested IFs / setting variables with directives

Mike mike at widowitz.com
Sat Sep 30 08:55:18 CDT 2006


Thanks, Pico.
I actually am already using your solution below. It only gets a bit
awkward as soon as you have one more level of complexity in everything..

Cheers,
Mike


Pico wrote on 30.09.2006 15:41:
> Mike wrote:
>> Hi,
>> it's a pity that no nested (:if:) conditions are possible. For
>> example, I want to define a multilanguage backlink in my footer pages.
>> However, this backlink shouldn't show up on Index (start) pages. So I
>> need something like (pseudo code, sorry)
>>
>> if page!=index
>>     if userlang = en
>>        "back to main"
>>     if userlang = de
>>        "zurück"
>> end if
>>
>>
>> One way around that, in case that there is no way to nest ifs at all,
>> would be to allow setting of custom variables. Something like
>> %setvar dummy somevalue%
>>
>> Then, one could check for
>> (:if dummy somevalue:)
>>
>> etc.
>>
>> Can that be achieved?
>>
> 
> Note that PmWiki allows you to combine conditionals.  See
> PmWiki/ConditionalMarkup.  Thus, while you can't nest one condition
> inside of another, you can combine the two to accomplish the same
> result.  Using you pseudo code example above, that means:
> 
> if page!=index and userlang = en
> "back to main"
> if page!=index and userlang = de
> "zurück"
> end if
> 
> Pico
> 
> 




More information about the pmwiki-users mailing list