[pmwiki-users] Fwd: pagelist of referenced items
Markus Heinzer
keusen at gmail.com
Fri Aug 13 02:36:43 CDT 2010
Ok. I got the point how those "nested" pagelists work. Thanks for
hinting and helping.
The code how it worked in my installation:
Instructions:
- Create one wikipage for each notion that you want to index (e.g.
Questions.answer125).
- Create all those pages into a special group (e.g. Questions)
- You can set these pages' titles differing from the pagename.
- Put anchors on "normal" wikipages. Use the notion's page name (not
title). E.g.: [[#answer125]]
- The nested pagelist first looks up all pages in the notion group (e.g.
Questions).
- Then for each finding it looks up the corresponding anchors on the
"normal" wikipages
-------------------------
(:pagelist group=Questions order=title fmt=#processquestion:)
(:if1 false:)
[[#processquestion]]
(:comment --- for the current question, list all pages outside the
Questions group that contain an answer ---:)
(:pagelist group=-Questions "[[#{=$Name}]]"
questionfullname={=$FullName} order=title fmt=#listanswerstoquestion:)
[[#processquestionend]]
[[#listanswerstoquestion]]
(:comment --- if more than one page answers the question, each will be
separated by a comma ---:)
(:template first:)
{{$$questionfullname}$Title}:
(:template each:)
[[{=$FullName}#{{$$questionfullname}$Name}|+]]
(:if !equal "{>$Name}" "":)
,
(:template last:)
\\
[[#listanswerstoquestionend]]
(:if1end:)
-------------------------
Since in my case I have 5 topic areas with each 200 questions this would
mean that I had to create 1000 pages. I solve this with a suffix. Like
that I can "recycle" the 200 question pages for each topic area. The
anchors are named [[#answer125-a]]. The pagelist looks as follows (for
topic area A):
-------------------------
!!topic area A
(:pagelist group=Questions order=title fmt=#processquestion-a:)
(:if1 false:)
[[#processquestion-a]]
(:comment --- for the current question, list all pages outside the
Questions group that contain an answer ---:)
(:pagelist group=-Questions "[[#{=$Name}-a]]"
questionfullname={=$FullName} order=title fmt=#listanswerstoquestion-a:)
[[#processquestion-aend]]
[[#listanswerstoquestion-a]]
(:comment --- if more than one page answers the question, each will be
separated by a comma ---:)
(:template first:)
{{$$questionfullname}$Title}:
(:template each:)
[[{=$FullName}#{{$$questionfullname}$Name}-a|+]]
(:if !equal "{>$Name}" "":)
,
(:template last:)
\\
[[#listanswerstoquestion-aend]]
(:if1end:)
-------------------------
This could more easily be solved if there was a loop function (something
like (:for:) (:forend:)) with a variable counting onwards. But I don't
think something like this is possible in pmwiki?
Thank you anyway to all!
Markus
More information about the pmwiki-users
mailing list