[pmwiki-users] Costom markup for gallery page

Ugo Mariani ugo at sinet.it
Sun Mar 27 14:00:53 CST 2005


On Sunday 27 March 2005 21:04, Patrick R. Michaud wrote:
> On Sun, Mar 27, 2005 at 07:49:09PM +0200, Ugo Mariani wrote:
> > I'm using pmwiki 1.0.8 and I would like to create a custom markup, but
> > after a few days searching, I realized mt php skills aren't up to it.
> > This is what I would like to do:
> > [...]
> > I would like to have a single page for the larger image (call it
> > LargeImage), and have all thumbnail links point to the LargeImage page.
> > Then, when I click on a thumbnail, the LargeImage page would get
> > displayed, with the appropriate image displayed inline.
> > [...]
> > This is as far as I've got. I've searched the list, found some
> > information on DoubleBrackets and on how to pass arguments, but I
> > couldn't get anything to work, and I'm stuck.
>
> Hmm, this would probably be a *lot* easier in PmWiki 2.0.  But here's
> a shot at a 1.x implementation:
>
> First, define the gallery: intermap link (in local/localmap.txt) with:
>
>     gallery    http://www.example.com/pmwiki.php/Group/LargeImage?img=$1
>
> Next, add the following to your local/config.php:
>
>    $DoubleBrackets['{$Img}'] = $_REQUEST['img'];
>
> Finally, in the LargeImage page, put the following markup where
> you want the passed-in image to be displayed.
>
>    http://www.example.com/path/to/images/{$Img}
>
>
> Okay, let's see what happens.  In any wiki page you can put
> the markup:
>
>     [[gallery:photo.jpg /path/to/thumbnail]]
>
> gallery:photo.jpg becomes a link to
> http://www.example.com/pmwiki.php/Group/LargeImage?img=photo.jpg --
> i.e., it jumps to the LargeImage page and has the desired image
> passed in the img= parameter.
>
> Inside of LargeImage, the sequence {$Img} is replaced by the
> value of the img= parameter, so the markup
>
>    http://www.example.com/path/to/images/{$Img}
>
> becomes
>
>    http://www.example.com/path/to/images/photo.jpg
>
> which is then converted to an inline image in the LargeImage page,
> which I think is what you wanted.
>
> How's that?
>
> Pm

That's neat... thanks a million!!!

It works perfectly, and in a MUCH simpler manner than my feeble attempt.
What's even better, now I understand how intermaps work, and they're pretty 
powerful... I can think of other applications for it, now that I've seen the 
light! :-)

I only had one problem: I created local/localmap.txt but the "LargeImage" 
parameter wasn't being passed on. I then modified /scripts/intermap.txt 
(adding the line you indicated) and it worked. Should I enable 
local/localmap.txt explicitly?

In fact this is not an issue, as it works just the same.

Thanks again for your help Patrick, and especially for pmwiki... keep up the 
good coding!

-- 
    __  __   _____    ______
   /\_\/\_\ /\____\  /\_____\
  / / / / // / ___/ / / __  /
 / / / / // / /\_\ / / / / /
/ / /_/ // / /_/ // / /_/ /
\/_____/ \/_____/ \/_____/
Ugo Mariani
http://ugo.sinet.it



More information about the pmwiki-users mailing list