[pmwiki-users] PData support for pagelisting images

Pico pmwiki at ben-amotz.com
Thu Sep 7 12:52:54 CDT 2006


Patrick R. Michaud <pmichaud <at> pobox.com> writes:

> 
> On Thu, Sep 07, 2006 at 04:00:33PM +0000, Pico wrote:
> > Patrick R. Michaud <pmichaud <at> pobox.com> writes:
> > > 
> > > On Thu, Sep 07, 2006 at 01:56:00PM +0000, Pico wrote:
> > > > Will the new PData {$:var} support pagelisting images?  
[snip]

> I'm not entirely sure why the pagelist part in Test.PData isn't working.
> I suspect it has something to do with the order in which markup
> substitutions are taking place inside the pagelist output.  Or perhaps
> there's just something else weird about the Test.PData page.
> 
> Since the implementation of pagelists and page content variables is going
> to be substantially reworked anyway, I'm not wanting to spend too much
> time tracking this particular one.

Might as well mention it here.  Are you considering the possibility that
pagelists might (one day) also grab data from other sources, and here I am
thinking separate databases and, specifically, mySQL?  I think that PmWiki 
could become a great frontend for MySQL and have been watching recipes, 
such as Cookbook/SelectQuery, and observing that such receipes should find 
ways to hook into core markup, specifically pagelists conditionals, instead 
of creating recipe-specific alternatives.

> 
> Also, I think there's a far easier way to do what you're trying to do -- 
> see below, under "An easier gallery".
> 

Wonderful.  Thank you!

> > Note, a second issue is the way that the thumbnail links work.  
> > [...]
> 
> One of the things that *greatly* concerns me about the {$:var} markup
> is that authors are going to get very confused by trying to put
> page variables in the values.
> 
> For example, on http://www.pmwiki.org/wiki/Test/EasyGalleryPic1, 
> there is:
> 
>   Thumbnail: %thumb%Attach:HaleyDog.jpg%%
>   Thumbnailink: %thumb%[[{$FullName}|Attach:HaleyDog.jpg"{$Title}"]]%%
> 
> Okay so far, but look at what happens when another page, say Test.XYZ,
> uses "{EasyGalleryPic1$:Thumbnailink}".  The page content variable
> is replaced by the Thumbnailink: line from EasyGalleryPic1 -- that is:
> 
>     %thumb%[[{$FullName}|Attach:HaleyDog.jpg"{$Title}"]]%%
> 
> But when Test.XYZ evaluates this string, we'll get the name and title
> of Test.XYZ, not the name and title of EasyGalleryPic1 (where it came 
> from).
> 
> It gets worse when we have a page called SomePage with:
> 
>     FirstName: Patrick
>     LastName: Michaud
>     FullName: {$:FirstName} {$:LastName}
> 
> because an author using {SomePage$:FullName} is going to expect the 
> result to grab the FirstName and LastName values out of SomePage and 
> not the current page.
> 
> I've thought about it a fair bit, and I'm not sure I like any of the
> alternatives.  No matter what is chosen we're likely to come up with 
> something that is very confusing to some.
> 

Looking at pagelists, I assume that one of the alternatives (that you don't
like) would be to allow {=$:var}, when used within a page, to specify the 
value in that page, for example:

     FirstName: Patrick
     LastName: Michaud
     FullName: {=$:FirstName} {=$:LastName}

> -----
> 
> An easier gallery
> =================
> 
> If we just want to create a gallery of images and thumbnails, and we have
> the {$:var} markup available, we don't need any additional special 
> Thumbnail: or Thumbnailink: properties in picture pages to do it.  Just 
> define the picture pages using normal markup, as in:
> 
>     !! Haley
> 
>     Attach:somepic.jpg
>     This is a picture of Haley at one year old.
> 
>     Categories: [[!Animals]] [[!Dogs]]
> 
> and then our gallery pagelist template can be:
> 
>     [[#gallery]]
>     (:if equal {<$Group}:)
>     >>lframe width=300px<<
>     (:if !equal
{=$:Attach}:)%thumb%[[{=$FullName}|Attach:{=$FullName}/{=$:Attach}]]
>     [[#galleryend]]
> 
> Okay, so how does this work?  Well, the value of {EasyGalleryPic1$:Attach}
> is going to be "somepic.jpg" -- the thing that follows the "Attach:" markup
> in the EasyGalleryPic1 page.  So, we can use the {...$:Attach} markup in a
> pagelist template to grab an attachment from each page in the list.  For
> the above [[#gallery]] template, it's given by
> 
>     %thumb%[[{=$FullName}|Attach:{=$FullName}/{=$:Attach}]]
> 
> so that for EasyGalleryPic1, we end up with
> 
>     %thumb%[[Test.EasyGalleryPic1|Attach:Test.EasyGalleryPic1/somepic.jpg]]
> 
> which is exactly what we wanted -- a link to the EasyGalleryPic1 page
> with its attachment as link text.

I haven't tested this, but does specifying a page name in an attach directive
work when uploads only uses group subdirectories (without additional page
subdirectories).  For example, if uploads directory structure is:
/uploads
 /PmWiki
 /Test
  somepic.jpg

Will "Attach:Test.SomePage/somepic.jpg" work, or would the link have to be
reduced to "Attach:Test/somepic.jpg"?

> 
> Since a picture page might contain multiple attachments, or we might
> want to add some styling or a caption to the image on the EasyGalleryPic1
> page, a slightly better approach might be to set the page as:
> 
>     !! Haley
> 
>     Image:: somepic.jpg
> 
>     %cframe% Attach:{$:Image} | here's my caption
>     This is a picture of Haley at one year old.
> 
> and then use {=$:Image} instead of {=$:Attach} in the pagelist.
> 
> *Lots* to think about here.
> 

No sh*t.

Pico





More information about the pmwiki-users mailing list