[pmwiki-devel] Templates and value arrays

Martin Fick mogulguy at yahoo.com
Wed Jul 16 20:37:54 CDT 2008


--- On Wed, 7/16/08, DaveG <pmwiki at solidgone.com> wrote:
> > You could create a custom pagestore so that you
< > actually do have pages.  
> Not familiar with pagestores -- I'll take a look.

Pagestores are used to define how pmwiki stores pages.
Normally this is in a directory in the filesystem,
but it could be a DB (there are a few) or anything
else that you want.  Pmwiki uses two pagestores
already by default, one to store pages in wiki.d
and another in wikilib.d.  Lookups are ordered
so if the first defined pagestore returns a page
it will look no further.


> > This pagestore could name the page after each 
> > image and it could populate page attributes.  
> It sounds like the plugin creates physical pages. Since
> I'm simply including links to remote images (at Picasa), 
> one of the techniques I use it to use 'virtual pages' with 
> the GroupHeader/Footer technique. I do also allow for actual
> pages, so this might work also.

In your case, the page store would also create virtual 
pages.  Pmwiki would think that the pages are real, but
they would simply be a lookup into picasa.  Your 
pagestore would need to implement all the Pagestore 
methods like read, write (perhaps it just fails), ls 
(this is how it would get integrated into pagelists)...
Each image would be mapped to a pagename.

When a read is done from the pagestore, pmwiki typically
returns the entire page as an array of attriubtes.  One
of those attributes is usually the "text" which pmwiki
uses to render a page from.  Other attributes are things
like "author", "lastmodifiedtime" ... You can define
your own attributes which would be looked up in Picasa
and you would make them available with pagevariables so
that they can be accessed from pagetext like this:
 {Image1$Caption}.

These attributes would be accessible from any page, 
including in a pagelist template...
 
> > If you put all of your images in a group you could 
> > then use Group.Header or Group.Footer as a template
> > to display the image using page (or page text)
> > variables.
> 
> So, here you suggesting that the header/footer would
> contain the page variables to display image data?

Yes, but it would be templated in the footer/header
so as to not include the page name.  This would
then render a common layout for each image.
Something like this:

  Caption: {$Caption}

  ...random formating...
  {$ImageURL}  (To display the actual image in the page)
  ...random formating...

  Date: {$Date}


> Part of my challenge here is understanding how this would
> this work with multiple images on a single page?

This is where you would do something similar to above, 
but with a pagelist template.  So to put more than one
image on a page you would create a pagelist that returns
all the images (virtual pages of images actually) that
you want to display and then you would use a template to 
display them however you want.  Perhaps like this:

  [[#ImageListTemplate]]
  !!!!{=Name}
  {=$ImageURL}
  {=$Caption}
  -----
  [[#EndImageListTemplate]]


Then you could even create albums with a standard 
template by using another group, say "Album" and this
might have virtual pages that return wikitrails of
images as the pagetext.  You could then put a generic
pagelist in the Album.GroupHeader which simply uses
the current page as a trail to get its pagelist from
making each album automatically with a pagelist!

  (:pagelist trail={$Name} fmt=#ImageListTemplate :)


Make a little sense?

-Martin



      



More information about the pmwiki-devel mailing list