[pmwiki-users] use pagelist results in function

Mark Lee mark.lee.phd at gmail.com
Mon May 27 09:12:30 CDT 2013


I haven't used a custom pagelist template before, but I think it can
replace a set of markup and functions that now only work on individual
pages. I hope there is a cleaner, and more powerful way to do this with
pagelist and a custom pagelist template. Here is what I have.

1. I have a group of pages for the plants in my garden collection. Each
page has the location of each planting, such as
(:plant x=10 y=20)
(:plant x=100 y=250)
where x and y correspond to the x,y pixel location on a map of my garden.
2. I have a markup that sees the (:plant:) markup and calls a function that
counts the number of instances of the markup and also saves the x and y
coordinates in some arrays called mapx and mapy.
3. I show the garden map with the markup (:gardenmap:) which calls the
function below. If this markup is not included, the map is not displayed. I
need this feature because I may not have the coordinates, but I want to
catalog the plant as being in my collection. The function of GardenMap() is
to show the map of my garden, and then a marker on top of this image
showing where each plant is located.

function GardenMap($pagename)
{
global $mapx,$mapy,$pcount;

$out = "<div style=\"background-image:url(
http://ediblelandscape.org/images/other/gardenmap.jpg);padding:0px;width:668px;height:263px;border:1pxsolid
black;\">";

foreach($mapx as $index=>$value)
  {
$marker=$index+1;
$out=$out."<plant style=\"position: relative; left: $mapx[$index]px; top:
$mapx[$index]px;color:red; background-color:white;\">$marker</plant>";
  }

$out=$out."</div>";

return Keep($out);
}


I think all of this can be replaced by pagelist and a custom pagelist
template. I could use some guidance.
Thanks,
Mark


On Sun, May 26, 2013 at 4:36 PM, Mark Lee <mark.lee.phd at gmail.com> wrote:

> I guess I can make a copy of the pagelist script and add any feature I
> want. I think I will explore that next.
>
>
> On Sun, May 26, 2013 at 7:38 AM, Mark Lee <mark.lee.phd at gmail.com> wrote:
>
>> How can I use the results of (:pagelist ...:) in a function? I a PTV in
>> some pages in a group that holds a number. such as (:size x=10:). I want to
>> generate a line of html for each page found if the value is in a range. I
>> can display the values in a table using pagelist, but I have other ideas
>> than just making a table.
>> -Mark
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20130527/e88a8da7/attachment.html>


More information about the pmwiki-users mailing list