[pmwiki-users] Recieving pagelist results in a recipe?

Petko Yotov 5ko at free.fr
Tue Feb 20 18:06:34 CST 2007


On Tuesday 20 February 2007 04:18, Petko Yotov wrote:
> Is there an easy (fast) way to recieve a result of a pagelist inside a user
> function?
> (To recieve it as an array.)
>
> To make it more clear, it would be inside a cookbook recipe, that would
> merge, intersect or diff two or more arrays of page names.
>
> The pagelist would be:
> (:pagelist name=Page* group=-Site,-Group2 string string2:)
>
> And it should just return a list of page names. No need to open and
> PCache() every page, to extract titles or page variables.
>
> But the list of pages should preferably be up-to-date, even if
> the ".pageindex" file is not.

Hi again. I've been tinkering and found something! So, just posting it if 
someone else needs it.


  $opt = array(
    'name'=>'Page*',
    'group'=>'-Site,-Group2',
    ''=>array('string', 'string2'),
  );
  $getall = 0;# 0 = get only names; 1 = all variables (mtime, user...)

  $what = MakePageList($pagename, $opt, $getall);


This will actually open all pages and cache all variables, which is slow, but 
is really easy to write and more secure about the .pageindex. Actually the 
same as a (:pagelist:) command in a page without the formatting.

Hope this helps somebody and releases additional creativity. :-)

Petko



More information about the pmwiki-users mailing list