[pmwiki-users] Conditional data

Patrick R. Michaud pmichaud at pobox.com
Wed Apr 5 07:12:18 CDT 2006


On Wed, Apr 05, 2006 at 10:22:56AM +0100, Octocias wrote:
>    I would like to be able to use ONE wiki page to display EITHER a summary
>    or the detail.
>    in the wikipage, I want to say:
> 
>    if ( page name ends with "summary" )
>        display this: "blah blah blah"
>    else
>        display this chunk of content.
> 
>    The problem is... I will be INCLUDING those wiki pages, so that means the
>    file names will be the HOST's file name, not the included filename.
> 
>    Any suggestions of how I can get around this? Seems it would be cool if I
>    could pass a variable to the page.

I'm not sure I understand the question correctly... if you want
the content to change based on the name of the including page
(as opposed to the included page), then it's just:

    (:if name *summary:)
    display this: "blah blah blah"
    (:if !name *summary:)
    display this chunk of content.

If you want the including page to select the summary or content,
use anchors:

  IncludedPage:

    [[#summary]]
    display this: "blah blah blah"
    [[#body]]
    display this chunk of content.

  OuterPage:

    (:include IncludedPage#summary:)  -- display summary
    (:include IncludedPage#body:)     -- display body

Pm





More information about the pmwiki-users mailing list