[pmwiki-users] relative position style

Peter Bowers pbowers at pobox.com
Wed May 8 09:47:32 CDT 2013

On Wed, May 8, 2013 at 4:23 PM, Mark Lee <mark.lee.phd at gmail.com> wrote:

> The X and Y position of the plant on the map is contained on the page.
> Lets say a tree is located at map coordinates <100,250>. I was thinking to
> use the markup (:xposition 100:) (:yposition 250). I could then use this
> information in what ever way is supported by pmwiki markup via
> {$:xposition} and {$:yposition}.
> 5. In html, I am able to place a marker using styles. For example, if I
> want a marker "1" at position <132,165> I use <plant
> style="position:relative; left:132px; top:165px">2</plant></p>. Is this
> possible in pmwiki?

Just set up your (:plant ...:) custom markup so that it produces this

Something like this:

(:plant 2 x=100 y=250:)

See http://www.pmwiki.org/wiki/PmWiki/CustomMarkup or
http://www.pmwiki.org/wiki/PmWiki/CustomMarkupAlt to see how to create your
own markup.  You will also want to take a look at
http://www.pmwiki.org/wiki/Cookbook/ParseArgs to handle the arguments

To get a quick idea of what it'll look like, here's a very slightly tested
chunk of code that may be somewhat close to what you want:

Markup('plant', 'directives',
  'Plant($pagename, "$1")');

function Plant($pagename, $args)

   $opts = ParseArgs($args);
   echo "opts=".print_r($opts,true)."<br />\n";

   $x = (@$opts['x'] ? $opts['x'] : 0);
   $y = (@$opts['y'] ? $opts['y'] : 0);
   $num = (@$opts['num'] ? $opts['num'] : 'Unnumbered');

   $out = "<plant style=\"position: relative; left: ${x}px; top:

   return Keep($out);

That should get the basic idea -- you can get more elegant using positional
parameters with ParseArgs or something, but this should be a good start.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130508/c70c9636/attachment-0001.html>

More information about the pmwiki-users mailing list