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

Pico pmwiki at ben-amotz.com
Sat Sep 30 08:41:11 CDT 2006


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


-- 

         __  /
        /   /
       /___/ _/  ___/  __  /
      /      /  /     /   /
    _/     _/  ____/ ____/

 >>>===pmwiki at ben-amotz.com===>




More information about the pmwiki-users mailing list