[pmwiki-users] Obtaining the raw output of (:pagelist:)
Petko Yotov
5ko at 5ko.fr
Tue Nov 15 11:12:26 PST 2022
To get an array with the page names, use FPLTemplatePageList().
Note, it doesn't return the pages, it modifies its arguments by
reference. So you can have something like this:
# if you call your function before stdconfig.php
include_once("$FarmD/scripts/pagelist.php");
# define array and options
$list = [];
$opt = [ 'group'=>'Main', 'name'=>'-C*,-W*' ];
FPLTemplatePageList($pagename, $list, $opt);
# $list has now pages from the Main group
# except those starting with "C" or "W".
To search for pages containing or not keywords, use something like:
$opt = [''=>['find','all','these'], '-'=>['except','those']];
To get a large array with all page metadata (except the page text and
history), use MakePageList(). This one returns the pages:
$opt = [ 'group'=>'Main', 'name'=>'-C*,-W*' ];
$list2 = MakePageList($pagename, $opt);
Note, both functions return all matching pages, before ordering the
array (order=-time) and before slicing it (count=10..30).
Generally, both should work, but in some cases the results will not be
the same, because $opt is defined in a complex way ($SearchPatterns,
$_REQUEST).
Petko
--
If you upgrade : https://www.pmwiki.org/Upgrades
On 15/11/2022 19:32, Gregor Klarič wrote:
> I would like to use the search functionality of pmwiki and use the
> result in a function. So basically I would need an array of the pages
> matching a search string.
> I assume I need to use one of the functions in pagelist.php, but which
> one?
More information about the pmwiki-users
mailing list