[pmwiki-users] populating array through markup

Dominique Faure dominique.faure at gmail.com
Wed Mar 1 16:17:34 CST 2006


On 3/1/06, Hans <design at softflow.co.uk> wrote:
> I would like to know a method to populate an array of arrays, through
> multiple markup with parameters (key=argument pairs).
>
> The markup will call a function, and the parameters get processed with
> the ParseArgs  function.
> There may be more than one markup on the page, and I wish to construct
> an array which will hold the arguments as arrays from each markup.
> How shall I go about this?
>

Assuming the accumulated datas would be used for current page, I would
populate a $PCache slot with them as in:

Markup('mymarkup, 'directives',
  "/\\(:mymarkup(\\s+.*)?\\s*:\\)/ei",
  "MyMarkup(\$pagename, PSS('$1'))");

function MyMarkup($pagename, $opts) {
  global $PCache;
  SDV($PCache[$pagename]['mymarkup'], array());
  $myArray =& $PCache[$pagename]['mymarkup'];
  # do what you want with your array
  # ...
}

Hope this help,
Dom




More information about the pmwiki-users mailing list