PData
This is testing the new PData capability, and the {$:var}
markup.
First, some data that we can look at:
Field1: Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Field2: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
Field3: Nisi ut aliquip.
To grab the value of a field from the current page, use {$:Field1}
:
Field1 = {$:Field1} Field2 = {$:Field2} Field3 = {$:Field3} |
Field1 = Lorem ipsum dolor sit amet, consectetur adipisicing elit. Field2 = Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Field3 = Nisi ut aliquip. |
To grab the value of a field from another page, use {pagename$:Field1}
(here the data is coming from TestData):
{TestData$:ABC} {TestData$:DEF} |
alpha beta charlie delta echo foxtrot |
Some other examples, grabbing Summary lines from Cookbook and PITS pages:
{PITS.00565$:Summary} {Cookbook.RandomQuote$:Summary} {Cookbook.RandomQuote$:Version} |
Placeholder for 2.1 features Insert random quotes or markup into a page 2007-02-15 |
The data can also come from definition lists (currently definitions have to be a single word):
:apple:green :banana:yellow :cherry:red {$:apple} {$:banana} {$:cherry} |
green yellow red |
The {$:var}
markup can also be used in page templates:
[[#summary]] * [[{=$Group}/{=$Name}]]: {=$:Summary} [[#summaryend]]
(:pagelist fmt=#summary group=Cookbook "Summary:" count=10:) |
|
(:pagelist fmt=#summary group=PITS "Summary:" count=10 order=-time:) |
|
[[#showthumbs2]] (:if equal {<$Group}:) >>lframe width=300px<< (:if:)[[{=$Name}]] - {=$:Thumbnail} (:if equal {>$Group}:) >><< [[#showthumbs2end]]
(:pagelist fmt=#showthumbs2 group=Test name=EasyGalleryPic* "Thumbnail:" :) |
EasyGalleryPic1 - EasyGalleryPic2 - Thumbnail: EasyGalleryPic3 - EasyGalleryPic4 - Thumbnail: EasyGalleryPic5 - EasyGalleryPic6 - Thumbnail: |
Here is a quick test to see how well the {$:var}
markup works with with images and in page templates:
[[#showthumbs]] (:if equal {<$Group}:) >>lframe width=300px<< (:if:)\ {=$:Thumbnail}\ (:if equal {>$Group}:) >><< [[#showthumbsend]]
(:pagelist fmt=#showthumbs group=Test name=EasyGalleryPic* "Thumbnail:" :) |
Thumbnail: Attach:GoldieCat.jpgAttach:HaleyDog.jpg ΔThumbnail: Attach:GoldieCat.jpgAttach:HaleyDog.jpg ΔThumbnail:
|
Note: This wasn't working. Why?
- I checked and confirmed that the appropriate pages were being picked up by the pagelist (by leaving links in the template, which I have since removed).
- I checked and confirmed that the use of images wasn't the problem (by changing substituting text for the thumbnail on one of the pages, which I have since restored)
- I checked and confirmed that the pages where the definitional markup resides do not need to be enabled (by grabbing a single thumbnail, as shown below)
{Test.EasyGalleryPic1$:Thumbnail}\\ {Test.EasyGalleryPic1$:Thumbnailink} |
Pico September 07, 2006, at 09:10 AM
Is this an upcoming feature or test of some already available recipe?
VKrishn August 30, 2006, at 11:27 AM
It's experimentation, based on things in PITS, the Cookbook, and a discussion on the pmwiki-users mailing list. A good place to start looking at the thread might be http://www.pmichaud.com/pipermail/pmwiki-users/2006-August/031461.html (although it actually begins before that, this message is the one where the {$:var}
markup is first introduced). Pm August 30, 2006, at 12:22 PM
I am not sure if there is any PITS entry for this. Please count my vote for this feature. VKrishn September 03, 2006, at 02:37 AM
Will there be a way to escape the colon to allow it to be treated literally as part of the defined value? For example, if I use it for defining titles of works, what happens if the title contains a colon, for example:
Artist: Roy Buchanan Album: Sweet Dreams : The Anthology
Workarounds would presumably include using the ascii code (%3A), or substituting a different character (-), but it might be nice to provide a more intuitive solution. What about allowing optional quotation marks, for example:
Artist: Roy Buchanan Album: "Sweet Dreams : The Anthology"
Pico September 07, 2006, at 09:10 AM
Only the first colon matters; the rest is left alone. For example:
Example: This example contains a colon: Look, it works! The value of example is "{$:Example}". |
Example: This example contains a colon: Look, it works! The value of example is "This example contains a colon: Look, it works!". |
Some oddness with "directive" values
- the first value
- a DL value
- a "directive" value
- And Foo is another "directive" value
Kathryn Andersen September 26, 2006, at 02:32 AM