It's better when it's simple

User Tools

Site Tools


Table of Contents

PageQuery Plugin Discussion

Discussion page for the PageQuery plugin

Older, resolved, discussions can be found in the archive

Formatting Suggestions

Given that we're all here asking questions about a Dokuwiki plugin, I think that I can safely assume that most know the basic wiki syntax. To keep the page tidy and readable I suggest that each question/idea is formatted as follows:

Short Description of Question

:?: Full question you would like to ask; try to keep it short and specific, using examples where possible. It is polite and useful to mention your name at the end of your question or answer, e.g. Interesting Person–2010-10-25

Use the standard reply syntax for each new answer
Another level

NOTE: I understand both French and German, so feel free to explain your problems, requests and suggestions in those languages also if it is more comfortable for you. Any useful information that comes out during discussion will be transferred to the main page now and again.


Change Formatting to "New Column on Heading Only"

This, in my opinion, makes for a much cleaner look. It'd be nice to have this as an option to make a “new column on headline only.”

Change line 141 of “pagequery.php” to:

if ($can_start_col && ! $prev_was_heading && $level > 1) {



I try to list all pages from namespace “hardware”, but without the template hardware:c_template. Here is my code:

@hardware; fulltext; sort=a,title; filter=!hardware:c_template; bullet=square; border=none; display={date:created} {title}

Unfortunately the filter doesn't work. No data appears. Whithout the filter it works fine.

Thanks a lot! Daniel

quite strange. When I use the filter critera in the query, then it works:

@hardware type:hardware:desktop; fulltext; sort=a,title; bullet=square; border=none; display={date:created} {title}

in this case pagequery only shows the pages from namescape “hardware” but only those with “type:hardware:desktop” in the page as text. This way it works. But other way with EXCLUDING a page it doesn't work.

Filter by mdate

:?: I can't seem to figure out the correct syntax to show only pages that haven't been edited within the last year using the date filter. Do you use the filter like this?

{{pagequery>->last 1 years;}}

Or like this?

{{pagequery>*; filter=mdate:->last 1 years;}}
I am using this for files that have not been updated in three months:
{{pagequery>*;sort=mdate;display={title} ({mdate});filter=mdate:->3 months ago}}

So you probably want to use “1 year ago” instead of “last 1 years” in your syntax.

Choose Start Point for Query

:?: No matter what happens, the query always starts from the home namespace. This means that when I post the data it tends to do the following:

Home NS
  NS 2
    NS 3
      NS 4
        Content 1    Content 2   Content 3
          Sub-1         Sub-1      Sub-1

Is this only good when working with 1 namespace in the wiki? I can't seem to figure out how to make it nicely only show the current namespace I am in and higher without editing the code which doesn't work really either.

Basically in pagequery.php I can edit the following line of PHP and set the starting level for the NS Operation, but it only works if we assume every request will be from the same NS Level:

for ($i = 1; $i < count($cur_ns); $i++) {

Format NS by Title

:?: You currently only have the ability to show the NS and capitalize the first letter of the NS and display the NS as written in the link. I have for example ns/energy/start - So it displays “Energy.” However the title of the page is “Energy Management” - this causes a problem because it won't actually display what I want.

If I get rid of “hidestart' it shows the page titles fine - but the NS is still there… so it ruins it… (Shows “Energy” then “Energy Management” which are the same link).

Also since it isn't honoring titles it ruins other parts.. for example I have a “dsps” page. This should be “DSP's” when displayed in the ordering. However it shows as “Dsps” which is confusing

Really surprised you didn't already have this… but I ended up formatting it myself - in forums I found that if I use this function I can get the namespace title/heading:
function getheading($ID) {
  $dir = "./data/pages/";
  $loc = $ID.".txt";
  $test = $dir.$loc;
  $first = "=";
  if ($file = is_file($test)) {
    $fh = fopen($test, 'r');
    $fr = fread($fh, filesize($test));
    $begstr = strpos($fr, $first, 0);
    $begstr = $begstr + 6;
    $count = strpos($fr, $first, $begstr);
    $count = $count - $begstr;
    $title = substr($fr, $begstr, $count);
    $title = $title;
  } else {
  echo "file doesn't exist";
echo $title;

So I did that then i changed:

$heading = $this->_proper($heading);

To the following:

$heading = $this->getheading($ID);

- I'm sure that causes problems in other circumstances but it does what I want… before this it was formatted terribly.I can't imagine a single person wanting it the other way?

Can't say I appreciate your lack of tact but I understand your problem and the latest release has been updated to provide this feature. The solution is very different from your own and does not affect other uses/users of pagequery. If you choose to display the links by title|first-heading then the namespace group headers will also based on the start-page first heading.
I also added a different way of upper casing that respects already capitalised words as you request above.

Thanks! Appreciate it!

Working examples?

:?: Could you please give an working example for your plugin. I'm not sure about limiting search to namespaces. Are relative paths allowed? {{pagequery>.}}

Yes, since version 0.7.3

Is it possible to sort by ID and group it by abc, e.g. A ..(all pages with heading starting with a)… B etc. (similar to indexmenu)

Update: Namespaces are now supported in page name mode too; see above

Symon Bent 2010-04-23 09:00

Turning off DokuWiki caching for instant updates

:?: I want to use this pagequery plugin to list all pages of a namespace,but when I add a new page in this namespace,it doesn't show,and I can see the page in the index view, could you please show me how to do it?

The plugin does not turn off the default DokuWiki page caching mechanism (I could make it the default, but not everyone wants that…), so you'll need to put:

somewhere on your page (i.e. the page containing the pagequery markup.) Symon Bent 2010-04-29

Snippets look unformated?

The plugin is great. But is it right that the abstract box information are unformated and only show s the wiki-code?

Yes, I'm afraid it is, it is based on the existing “abstract” feature built into Dokuwiki, and that is the current output. I'll look into improving it, but it requires more work than I have time for right now. Symon Bent 2010-07-05

Multi lang site problem?

:?: I have the translation plugin (translation) installed and having trouble listing only one language. The pagequery lists both the 00basemodule:01something:12somethingelse and the en:00basemodule:01something:12somethingelse pages. Please advise how to list only one language.

Ok, to answer my question: I had trouble using regexs, because I missed out the fullregex keyword. Using the fullregex and the “^00basemodule” and “^en:00basemodule” regexs solved my problem.

Well, I'm glad to hear it! It never hurts to read the manual… ;-) Symon Bent 2010-07-05

Last pages?

:?: Hi, thanks for this nice plugin. Is it possible to show the last created pages? Andreas

Yes, it is possible. I do this on my own wiki at home. For example, to show the last 10 created pages in the entire wiki the following options would work:

If you study the options table above you'll find others ways to adapt this example to your real needs. Hope this helps! Symon Bent 2010-Aug-24

Perfect, thanks a lot! :) Andreas

Customizing Group Headers

:?: This plugin is great! I'm using it for kind of a special case. Basically, I want to list all of the pages in a common second-level namespace used throughout our wiki. For example we have HR:Policies as well as Medical:Policies. I wrote the following to display all of the pages in the secondary Policies namespaces, regardless of the primary namespace:

 {{pagequery>@*.:policies *;sort=ns,name;group;proper;cols=1;fullregex;}}

The only problem I am having is in the group headers. For the first one, for example, I see [H1] Medical [H2] Policies [Page Listing], then for the second one [H1]HR [Page Listing]. So, the “Policies” header is only showing up for the first primary namespace listed. I would prefer that it didn't show up in any of them (since I can just put at the top “Policies”), or that it showed up on all of them. I modified the code myself in a very “hacky” way to fix this problem by just looking for secondary namespaces called “policies” and ignoring them, but I didn't know if there was a way you could build in an option for this…could be something as simple as “ignoreheaders=policies” just to leave it out of the group headers, or perhaps a more complicated system that was smart enough to realize that given a namespace query where a wildcard is used, I want to ignore the groups of any non-wildcard parts…

Forgive my confusion, I'm still struggling to understand the exact problem, but my first suggestion would be to have 2 separate pagequery lists on the same page, e.g:
{{pagequery>@hr:policies *;sort=ns,name;group;proper;cols=1;}}
{{pagequery>@medical:policies *;sort=ns,name;group;proper;cols=1;}}

From what I have grasped so far, they are anyway unique topics. What you are asking for towards the end sound quite complicated…I would have to spend some time thinking about the concept! Basically you want to pull in pages from different namespaces and still group them by namespace. This is difficult as the two namespaces may not correspond at all (by name and depth), so how should the plugin decide which heading gets used? Currently, as you note, it is only designed to handle one parent namespace. –Symon Bent 2010-Sep-05

Use of mb_substr function causing syntax errors

:?: Line 494 of syntax.php causes a syntax error under some circumstances (sort options) because function “mb_substr” is unknown. I removed the “mb_” and it worked. Is there a special reason to use mb_substr here? — Jochen 2011-01-13 10:50

I guess you do not have extension=php_mbstring.dll (or .so)” enabled in your php.ini file. I'll change this line to use the built-in Dokuwiki function “utf8_substr” instead in the next release. This function ensures that multi-byte encodings are correctly allowed for when choosing the first 1-3 letters of a word. (Think accented languages…)—Symon 2011-01-13 14:00
I think you're right with the missing extension, but I have a workaround anyway. Thank you! — Jochen 2011-01-13 14:04

Excluding Pages

:?: How can I explicitly exclude certain pages from the pagequery list?

This question is a little vague, but if you are just searching by pagenames then you can exclude pages using a regular expression, otherwise there is no other way to do it. If you could be more specific about your needs maybe I could find a solution or even add the functionality you are looking for.–Symon 2011-01-25 09:03
I have the same doubt (I am the user below), you could create an example of exclusion of namespace with regular expressions?
After a little local testing I can see that I need to improve this feature—I did try to provide the same ^exclude and @include syntax as the normal Dokuwiki page search but it does not work consistently. I'll work on this in the coming weeks, and see what I can come up with!—Symon 2011-01-31 11:55
Update: I have the include/exclude feature working correctly now on my dev version at home; I'll release an update in the coming days. Syntax as per normal Dokuwiki search @namespace -or- ns:namespace for includes; ^namespace -or- -ns:namespace for excludes. Note: excludes take precedence, and only included namespaces are displayed.
0.6.7 Released on 2011-Feb-01
This also works perfectly! now this plugin is perfect for me! you are superman ;-)
It's always a pleasure to help! Glad that it serves your needs.—Symon 2011-02-03

:?: something still goes wrong.
The pagequery>*;namespaces=^blog ^syslog;sort=ns,name:asc;cols=2;proper;border;title;natsort tag does not exclude blog and syslog namespaces.
What am I doing wrong? — jno 2011/06/28 12:46

There is no such parameter namespaces=… (sorry for any frustration!.) Pagequery “queries” were designed to work the same way as the standard Dokuwiki search box. The following change should help you:
{{pagequery>^blog ^syslog *;sort=ns,name:asc;cols=2;proper;border;title;natsort}}

You can also write it this way:

{{pagequery>-ns:blog -ns:syslog *;sort=ns,name:asc;cols=2;proper;border;title;natsort}}

if that is clearer to you.

See if this does want you want… Regards Symon 2011-06-28 17:24

Thanks a lot! This way it works. — jno 2011/06/30 16:20

I dont found the way to exclude some pages named “index_ in all namespaces??”

{{pagequery>* -ns:playground -ns:wiki ;sort=a,name;group;limit=0;inwords;cols=3;proper;border=both;nostart;useheading;snippet=tooltip;natsort}}

I have at every namespace one page who named “index_??”
Some solutions? - Alex

My first suggestion would be (if you are using the latest development version) to use the new filter option to remove the unwanted pages. This also accepts regexs like the search query. See the help page for details.—Symon 2011-10-07 21:19
Thx Symon for answering. And yes I use the latest dev version from 2011-08-22.
I do this - but no chances.
{{pagequery>* -ns:playground -ns:wiki -ns:en ;filter=index:.*;sort=a,name;group;limit=0;inwords;cols=3;proper;border=both;nostart;useheading;snippet=tooltip;natsort}}

When I insert “fullregex” before “;filter ..” I get this message

pagequeryNo results for the search query: « * -ns:playground -ns:wiki -ns:en »
There is an error in the regular expression. Check and try again.

I want to exclude the namespaces “wiki, playground, en” and the pages index_.. in every namespace. Can you make a example please because I am new with regex and dont know what to do.
Thx Alex

"nostart"-Parameter scheint nicht zu funktionieren

Ich habe bei meinem Dokuwiki das Vector-Template installiert und habe in der Navigation auf Namespaces verlinkt. Eine solche Namespace-Seite habe ich (da wie eine Art Index gedacht) nun mit diesem Code gefüllt:



Die Startseite selbst, also eben diese Namespace-Seite, auf der man sich gerade befindet, wird aber ebenfalls in der Liste dargestellt, genauso wie alle Startseiten der “Unterkategorien”, denn ich unterteile den Fahrzeuge-Namespace nochmal in Toyota- und Lexus-Fahrzeuge, und danach jeweils in Konzept- und Serienfahrzeuge. Überall, wo es Seiten in diesen Namespaces gibt, wird in der Liste auch die entsprechende Startseite des Namespace mit angezeigt. Woran liegt das? Denke ich falsch, und das ist ganz normal, weil das gar keine Startseite ist? Kann ich die aktuelle Seite denn irgendwie ausschließen?

- Jorin 28.01.2011

Please stick to english language. At least to let the plugin author understand it.
Do you use “start” as default name for start-pages? — lupo49 2011/01/28 19:36
Sorry, I read this notice and thought I could write in german:
“NOTE: I understand both French and German, so feel free to explain your problems, requests and suggestions in those languages also if it is more comfortable for you. Any useful information that comes out during discussion will be transferred to the main page now and again.”
Yes, I use “start” for the start page.
- Jorin 28.01.2011
Seems to work now. I had the start page named “Start” in the admin section. Changed this to “start” and now it works great!
Thanks for your help, lupo49.
- Jorin 29.01.2011
I was going to mention that the plugin honours the start page name as configured in your config file. Thanks for sorting that out lupo49. I read German fine so no problem; I might mention this potential problem in the FAQ when I get time (in English)—Symon 2011-01-30 16:10

Filter exclude page with pagequery

I try to exclude the page, which is inside the searched namespace, but there is no result the query says. Any idea? Thanks, Christian

{{pagequery>@myns mytext;fulltext;filter=!myns:statistik;sort=ab,name;display=title;group;proper;cols=3}}
Found it, it must be
{{pagequery>@myns mytext;fulltext;filter=!name:statistik;sort=ab,name;display=title;group;proper;cols=3}}

>How can i exclude several page?

Fullregex for listing pages starting with...

I am using and appreciating your plugin every day. I took me some time to work out one thing, and now I am stuck with another. So maybe I can help, while asking help myself.

:!: The example of listing pages starting with numbers [0-9]+.* didn't work for me. Instead I got a listing of all pages which had a number in them. The same thing when I tried listing only pages starting with the letter “a” (a+.*), I got all pagenames containing the letter a…

I played around a little, and concluded this requires fullregex mode, so the working syntax reads:


I'm up to date on the stable branch of Dokuwiki and Pagequery 0.6.8.

For starters you'll need to use a regex like ^[0-9]+.* to filter only words beginning with, however, to provide some consolation: there is a problem with the regex searching code, which I am busy fixing. fullregex is just for searching the entire pageid including namespace, that's why your 2nd example works. Watch out for a new release in the coming days to resolve your problem.—Symon 2011-Mar-05 21:18
Wouldn't starting with ^ also indicate skipping a namespace…? —Eivind 2011/03/06 14:10
Yes, hence see the additional comments in the parameter description table further up the page. I'm trying to offer the best of both worlds: Dokuwiki syntax and regular expressions; it's the best solution I can come up with for now.—Symon 2011-Mar-07 21:38

Natural sorting

:?: I have pages that are called 1, 2, 3 and so on, and articles that start with numerical values like 10, 100, 1000, etc. It is important for me to list these logically. Is there any way to do this with regular expressions, or do I have to change some code in the plugin itself? To be fair, I also have this “problem” or need with another plugin, so maybe the solution lies not in changing any Pagequery code at all, but rather in Dokuwiki… —Eivind 2011/03/05 11:09

What you are looking for is called “natural” case sorting; this is of course possible Eivind, however it will require a complete rewrite of the multi-column sorting function the plugin uses (because the PHP function array_multisort does not provide natural sorting.) I'll think about it, but providing this will considerably slow down the plugin, because sorting would have to be done manually in PHP.—Symon 2011-03-05 17:38
Thanks for the quick response! Would there be a possibility of using a different PHP function that provides natural sorting, in exchange of limited plugin functionality? I'm just asking out of curiosity. —Eivind 2011/03/06 14:20
I wish it were that simple, unfortunately the existing natsort function provided by PHP is for one-column only, which would severely reduce the functionality of pagequery. There are other solutions like I said, but they are not simple, and once I get some more time I'll look into your request (solutions are welcomed!)—Symon 2011-Mar-06 16:51
UPDATE: Just a quick update, I have a new version running on my dev machine at home that now allows correct natural/caseless sorting (and perhaps a few other sorting options too… WIP). It's functioning well so far, but it needs a bit more testing before I can release it officially. Thanks for the idea Eivind, it required a 50%+ code rewrite but I think that the result is a better, more flexible plugin. I also ended up with some pretty useful array multi-sort and grouping functions that will serve me well in other projects. Check the source of the new release if you are looking for something like that.—Symon 2011-Mar-15 16:40

After testing the new version extensively, I have decided to go back to the previous version. I am using Pagequery very actively in navigation, and one of the factors that made me choose this in the first place was the speed of the plugin. This, unfortunately, seems to be one of the costs for natural sorting… Or maybe the cache system has changed in the more recent development version of Dokuwiki?

I'm sorry to hear that; on my own installation the new version does not seem to be any slower than the old one, maybe the problem is something else. I could do a proper performance test if you like. How many pages do you have in your wiki?—Symon 2011-04-11 12:48
I'm happy to hear that, and will give it another go after upgrading server and dokuwiki. My example: I have a template page containing links A:start B:start C:start, etc. These pages each contain a pagequery query similar to >wiki:a.*;fullregex;nostart. The template is included on top of each of the start pages, effectively creating the illusion of an alphabetical sorting option. Although I only have around 120 pages at the moment in that particular namespace, it took the new version around 3 seconds to show a page (in local development), which dispels that illusion. —Eivind 2011/04/11 20:28
The problem is not the sorting (120 pages on my home wiki averages 0.03 seconds to sort); I'll profile the code and see what the delay could be.—Symon 2011-04-12 21:55
Hi Eivind, I just profiled the plugin using xdebug and webgrind and the problem is overwhelmingly two things: 1.Getting the the page metadata (I changed the code to retrieve it only once per displayed page—shaved off 1 second), and 2.The ACL check on the page results. There is little I can do about either of the problems as they are part of the Dokuwiki core, but be assured that the slowdown is definitely not the natural sorting routine.—Symon 2011-04-14 19:00 Here's the latest version if you want to check it out!
Although my wiki: namespace is around 120 pages, the total number of pages in my wiki is 7.000… And that is just for development and testing, the production version will have closer to 100.000 pages. The thought crossed my dull mind that maybe this affects the speed of a fullregex search? ;-)Eivind 2011/04/12 22:23

Tableless version when only one column

:?: I have also thought of making a tableless version for single column usage, where the TOC will overlay the abstract/snippet, and not push it down. So that means I will have two versions of Pagequery running for separate purposes. Please let me know if this sounds like a bad idea. —Eivind 2011/04/11 10:59

I don't quite understand what you mean by: TOC will overlay the abstract/snippet, and not push it down…”. Could you explain further?—Symon 2011-04-11 12:50
The pagequery table “collides” with the TOC, and is pushed downwards on the page, creating unnecessary empty space between header title and content. I want the TOC to make the text flow around it instead. Please forgive, but I cannot explain better at this late hour… —Eivind 2011/04/11 20:31
Got you, your explanation was fine, my understanding was lethargic! I've updated the code so that when only one column is displayed no tables are used. Is that what you are looking for?—Symon 2011-04-12 21:50
That's exactly what I'm looking for!

Improving the Abstract formatting?

Since you are both effective and responsive, how about this one: The abstract usually hides stuff that exist within a WRAP (DIV) or image captions from the Imagebox plugin. However, typographical replacements, acronyms and entities like (c) show up none the less, making the abstract less appealing. I can of course turn off the replacements and remove the affected acronyms, but if there exists another solution, I would be happy to hear! —Eivind 2011/04/12 22:12

I would like to find a better solution myself also. The snippet is based on the abstract meta-data entry, produced by the built-in Dokuwiki meta-data renderer. I would prefer to show the abstract using normal Dokuwiki markup, but that's going to have to be a project for another day. I have not worked out how to do it yet. Any suggestions are welcomed; what do you hope to see in the snippet?—Symon 2011-04-14 17:55
The snippet is not bad at all, although I wouldn't mind what you have mentioned below in regards to character limitation, or maybe just showing the first sentence or paragraph. In that way, I don't have to count characters when writing introductions. I actually turned off the typographical replacements and removed some of the abbreviations/acronyms to overcome the problem challenge I faced. Working within the boundaries often works just as well as trying to expand them. —Eivind 2011/04/16 18:04

Excluding Namespaces Example

:?: Why does this code {{pagequery>* ^calendario;sort=mdate,name;limit=10;inwords;abstract=none}} not exclude “calendario” namespaces?

See the instruction table above: the namespace needs to be before the * or other page name query. I'm still looking for a better solution, but that's the way it works for now.—Symon 2011-03-08 08:49
Ah, okay, I had not grasped it but now it works, thanks :)
If any pagequery users have suggestions for how to improve the query syntax (it is modeled on the current Dokuwiki search syntax) please feel free to offer them. The main problem is distinguishing between ^exclude_namespace and ^regex_from_start_of_line (i.e. they both use ^ at the beginning!). Right now, as mentioned in the instructions, the plugin assumes that the last item is the search query.—Symon 2011-Mar-15 16:48

Search in current namespace

I don't know if it is possible to add the search in the current namespace (of the page) like this example:

{{pagequery>@. ^mypage.*$;nostart}}

Perhaps there is another way than to completely write the namespace.

Not at the moment, but this sounds like a good idea, I will try to add it to the next release when I get a little time!—Symon 2011-05-13 08:35 EDIT: this now works in latest 0.7.3 version.

Clarify Page Exclude + CSS in New Version

:?: Hi Symon. Great plug-in!! This is actually 2 questions in one.. Firstly are you able to clarify how it is best to go about excluding certain pages in a namespace? For example I have a namespace where I only need to show around half the pages in the pagequery based index. So I have started all the “hidden” pages (page id's) with zz. So I would need something like:

{{pagequery>@. !zz.*;fullregex}}

Or can it be done without fullregex in a simpler way? Or is what I´ve done there just plain wrong :-)..

There is no facility for excluding certain pages except a regex query; any other solution (like lists of pages to exclude) would quickly get messy and hard to maintain. As for your regex something like this should work:
{{pagequery>@. ^(?!zz).*;fullregex}}
^ => start from beginning of pageid
(?!zz).* => any text not beginning with "zz"

Second smaller point, seems since I upgraded to the current version (0.7.3) the pagequery table insists on taking up much more than 100% of the screen (with IE8, not sure about other browsers..) leaving me with a horizontal scroll bar and lots of white space, did you change the CSS? Cheers! —Hans 2011-06-17 20:50

Hi Hans, this does sound like a IE8 issue; I do not have this problem in Firefox, Chrome or Opera… I'll try to find what the cause is. There is a change in the newer version, where no table is used if there is only one column—this works better with the TOC. Symon 2011-06-21 20:47
I also had this problem while using IE8. The table was always the right length but there was always a block of white space the same size of the table on the right hand side. I got rid of this with an overflow: hidden in the first part of style.css:
div.dokuwiki div.pagequery {
    overflow: hidden;
    margin:0 0 1em 0;
    border-radius: 8px;

Query namespace returns 'No results for the search query' after upgrade

:?: Hi Symon - Fantastic work - really appreciate it. However I recently upgraded to dokuwiki 2010-11-07 + PHP53 + pagequery current, building index page within namespaces is failing with 'No results for the search query' message. I was using:


and is getting

 pagequeryNo results for the search query:   @system_checklist:reports 

where systemchecklist:reports is the namespae I am interested in searching. I have no problem build the index from the entire site:


I could not see any errors in any of the log files. If I put in @system_checklist:reports into the search box of the wiki, all the pages shows up. Would you please help?

thanks and regards Dickson

If you type:
 {{pagequery>@system_checklist:reports *;sort=myear,mmonth;group;inwords;cols=2;border=both;nostart}} 

it should work (notice the “*” at the end of the query). I'll also check if there is a problem here in the plugin.—Symon 2011-07-01 14:05

UPDATE: since the addition of relative namespace queries in 0.7.3 the syntax now matches the normal Dokuwiki namespace format. That means if you want to refer to a root namespace you'll need to change the query to @:system_checklist:reports otherwise the current namespace is assumed. Sorry for any frustration!—Symon 2011-07-09 18:54

In your explanation for the “fulltext” option you link to the default Dokuwiki search documentation. It states there that you can exclude pages from the results by preceding exclusion words with a dash (-). It would be very handy if the pagequery plugin could support this as well, as it would be a simpler option than fiddling with a regex in combination with specific characters in a page-id (as discussed above in some topics) to exclude certain pages in a namespace from the results. —Hans Peter Willems 2011-09-08 17:00

A way to exclude pages seems to be a common request. Supporting the Dokuwiki search syntax in the page-id search would clash with the regex syntax, and require some way of switching between the two. I am leaning to simply add a new exclude=<list of page names> option, perhaps with basic wild-card support (* and ?). This might be easier to understand and use for most users. What are your thoughts?—Symon 2011-09-08 18:21
Thanks for your reply. Re:Supporting the Dokuwiki search syntax in the page-id search would clash with the regex syntax… I was not suggesting to use it for the page-id, but to extend the search functionality as it is already available with the 'fulltext' parameter. What I want to accomplish is to exclude pages based on a 'marker-word' that is inside the pages text. I hope this makes it more clear. —Hans Peter Willems 2011-09-09 09:05
Pagequery uses the standard Dokuwiki full-text function to do its searching, so it already has this functionality. It should work as you requested above.—Symon 2011-09-11 19:34
OK, thanks for the reply Symon. I found out where I went wrong; when using an exclusion string that has more words and therefor needs to be inclosed in quotes, the dash has to be outside the quotes (I obviously had it inside the quotes). I hope this might help others using this functionality. I like to add my thanks for this great plugin as it is now at the core of my dokuwiki-based knowledge management system (containing several thousands of pages already). — Hans Peter Willems 2011-09-10 20:23

Sort pages with Cyrillic pagename

Dear Symon, I use version 0.6.8, because on my hosting installed PHP 5.2. How to select pages by first character, for example - Б (Cyrillic alphabet) and sort by first 3 characters alphabetically (by Cyrillic alphabet)? Is it possible? Thanks! —Anton Mymrikov

Sort by pagename; display by title

:?: I'm working on a way to sort by page name but display by title since I have a lot of pages on individuals. The idea would be to name the page “surname firstname” for sorting and then display the page title. I have enabled useheading in dokuwiki which seems to be working yet I'm not getting titles in my list. My syntax is as follows;

{{pagequery>@:book *;sort=a,name;group;cols=3;proper;useheading}}

I'm using Rincewind with 0.7.4 of pagequery. Thanks for your help —Ron Field 2011-09-26 00:25

You'll need to download the development version to be able to use the useheading option; I have not released a stable version for a while (I've been too busy with real life recently sorry). There were some problems with the title/useheading option in the previous version.—Symon 2011-09-26 11:54
Thank you very much for the quick response!! I'll give it a try today. —Ron Field 2011-09-26 09:00
Possibly I've misunderstood the function? I thought the sort would be by page and the title would then be displayed. eg. page-“field_ron”, title-“Ron Field” would sort under “F” but be displayed as “Ron Field”. It is displaying the title now but it's sorting by the title. So using the previous example I get the title “Ron Field” sorted under “R” even though I specified “name” for the sort. —Ron Field 2011-09-26 11:31
By default it sorts by title if this option is enabled. As you rightly point out it should be possible to sort by page name but display by title. I'll add that to my next update—it makes a lot of sense. I've just not needed that feature yet…! I can't promise anything but maybe by the weekend—Symon 2011-09-26 20:44
Thanks Symon! I really like the plugin and your support is excellent! —Ron Field 2011-09-27 9:45
Check out the latest development version and see if it does what you expect now. It works on my test installation at home. I've added a new title option for the sort parameter, e.g. sort=title. The useheading or title option now only affects what is displayed, not how it is sorted. Off to bed now!—Symon 2011-09-29 21:25
I installed and so far it works great! I'm able to name and sort pages by surname_firstname and create an index by displaying title. Excellent, thank you very much! —Ron Field 2011-09-30 9:54

:!: If you install the development version you have to rename the plugin subdirectory to pagequery Joachim 2011-11-05

Feature Suggestion - Query against Tag index

A nice feature would be to add a tag switch to allow querying tags only. The idea is to use pagequery instead of topic to have a nice display of pages with a specific tag(s). Currently I'm not able to list pages with a tag such as “Field” as all pages with instances of the word “field” are displayed. I was trying to use subjectindex but indexes aren't working. My only option currently is to use “topic” page with it's single column. Thanks —Ron Field 2011-10-29 20:14

Querying tags requires getting data from someone else's plugin, I don't really have the time or the need myself to start playing with that right now! I use subjectindex every day for exactly this purpose, what are your problems with that plugin? Why not submit a bug report on GitHub so that I can start troubleshooting your problem?—Symon 2011-11-06 08:31

Feature Request - collapsible groups

If it is possible to collapse and expand the groups it will be great!
With option collapsed or expanded at start! Joachim 2011-11-05

Once the new jQuery version of Dokuwiki is release I might consider this, however it is more tricky than you realise. What happens on multi-column tables? This only really works well when you use a single column (like indexmenu, why not use that?)—Symon 2011-11-06 08:31

Not compatible with versions prior to PHP 5.3!

After trying to install via Rincewind's plugin manager, the wiki dies with the following error

Parse error: syntax error, unexpected T_FUNCTION in <snip>/www/help/lib/plugins/MrBertie-pagequery-1d53ee4/syntax.php on line 866

This is an issue with PHP before 5.3. Rather than showing an error (maybe a little filter at the syntax.php beginning), the wiki is down after starting the installation.

For those who did not read the PHP 5.3 instruction: Delete to pagequery directory to get your wiki running, again.

I'll look into putting a check for PHP 5.3 in the code—Symon 2011-12-09

Exclude only certain pages

Dear Symon, first of all thank you for this plugin!
Now my question: Is it possible to exclude only certain pages from the index? As i understand the “filter” option can't to the trick.
For example: One has ten pages an creates an index with pagequery. One of the ten pages is named “apple pie”. Is it possible to exclude this page so that just the other nine pages are listed in the pagequery index? In case it is possible could you make an code example please? Thank you! Bjoern 2012-02-26

Hi Bjoern, I would like to help, but I do not clearly understand your example "One of the ten pages i "pie". I it possible to exclude this page?" Could explain your example a bit more clearly?—Symon 2012-02-27
Hi Symon! Thank you for your quick response! Sorry for the misunderstanding! The text I wrote before contained some errors. I just adjusted the text. Is it now clear what I mean? Bjoern 2012-02-27
Hi Bjoern, it can be done with the filter option but excluding something with a regex is unnecessarily difficult. Hence I have updated the plug to allow for an exclude option when filtering, by putting ! or ^ before the filter column/field. E.g:
filter=!title=apple pie  -OR-  filter=^title=apple pie

filter=^title=(?i)apple pie  => case insensitive
filter=!title=^(?i)apple.* => case insensitive; titles beginning with "apple"

I'll push a new version later today.—Symon 2012-02-27

An update just for me??? Wow… I don't know what to say… THANK YOU VERY VERY MUCH!!! Bjoern 2012-02-27
You're welcome, it seemed like a good idea that other people would appreciate too, so why not! ;-) The new version has been uploaded already.—Symon 2012-02-27

Full page names

I needed the feature to display full page names, including the namespaces, I haven't found a way to do this with the current version (latest - 2012/02/27). You could create a new option for this, for example “fullpagename” or “usepageid”, and if it's present in the option list, just use the page id instead of the $name when extracting the $display information from the $sorted_results array.
Anyway, thanks for the plugin, it's very useful! — soravis 2012/03/02 21:03

Yes, “you could” couldn't you ;-) I'll have a look at your request and see if I can incorporate it in a sensible way into the option list. — Symon 2012-03-03
I only made a dirty quick fix, I'm sure you will solve it more gracefully. :) Thanks! — soravis 2012/03/03 20:30
Wow, you already did! :D Thank you, that was fast! — soravis 2012/03/03 20:34

List Namespaces

Hi Symon, great work, thanks for all the fixes/upgrades/… so far! Is it possible to list namespaces instead of pages like in the nspages plugin? —Hans 2012-03-03 21:25

Do you mean listing the namespace names only, without showing the page links? Or do you mean listing pages sorted by namespace? — Symon 2012-03-04 08:17
Sorry, that was not very clear was it..yes, I mean listing the namespace names only..—Hans 2012-03-04 09:25
So, if I understand correctly you want to see just the namespace without a link, or so you need a link to the namespace start page also? — Symon 2012-03-04 17:50
Yep, a link to the start page would be best. I guess searching for all pages with the page id start and displaying the titles would allow me to do this? Using the new filter options maybe even without fullregex..—Hans 2012-03-04 20:53
I use

it would be nice to have a link to the start page of each namespace (a klickable group header), a great addon btw

BTW: I'm working on the clickable group header idea (good thought), it's progressing well, but needs a bit more testing before I release.—Symon 2012-03-26

Syntax Problem

Hello Simon,

I have installed the old version for me (without PHP). Unfortunately, I do not quite cope with the syntax.

I also would like to have sorted everything by year and month at my sides as in the case of you in the picture:

The problem could be the construction of my Wikis since I don't use a menu Plugin for the construction.

My side isn't built up directly after named rooms.

An example:

My Sidebar is laid out as follows:

Word 2010
Office 2010
Excel 2010

(laid out in corner brackets if not visible)

If I click on a category, then a window with the topics opens. I click the side then opens itself on the topic with the fitting contents now.

How can I to have converting around it also just like in the picture?

If it is possible, I would like this in everybody, however, category-isn't mandatorily necessary.

Please excuse not perfect English since I have written the text in German and have then had translated.

I hope you can help me please.

Yours sincerely


Hi Icewind, could you post your original version in German also so that I can understand exactly what you mean?–Symon 2012-03-20
Hallo, das Problem hat sich schon geklärt…
Gut zu wiessen, mit der Zeit loesen sich die meisten Probleme… ;-)Symon 2012-03-27

Install Problems

I used this link in PlugIn Manager to install PageQuery.

Somehow this does not work. After downloading I found this entry in my plugin list: “MrBertie-pagequery-7a87183”. But if I build a simple page (e.g.


) there is no effect. I also deleted the former PageQuery plugin. Any ideas what went wrong? Thore 2012-03-21

I'm sorry but you cannot install pagequery through the Plugin Manager due to the way it is hosted on GitHub, you'll need to install it manually.–Symon 2012-03-26
Thanks for the information. You should modify the plugin page because there is still this instruction: You can download and install it from the Plugin Manager using the URL given above. Thore 2012-03-28

TOP Anzeige und Anzhal der selektierten Seiten

Hallo Symon, bei mir werden nach dem letzten Update neu die Anzahl der selektierten Seiten am Anfang der Liste (cols=1) angezeigt?? Und gibt es eine Möglichkeit den Top-of-Page Link nicht anzuzeigen (wird bei mir immer angezeigt…)? oscon 2012-04-02

Bald…! Symon 2012-04-11


Hallo Simon,

ich möchte in meinen Kategorien die dort angegten Themen nach erstelltem Datum sortieren. Das neuste sollte oben stehen.

Die Kategorien sind so angelegt:




Dort enthalten sind dann die Themen die dann beim auswählen die Inhalte anzeigt.

Wie kann ich das erreichen das z.b in [[Word]] die Themen sortiert werden? Ist das überhaupt Möglich?

Ich habe von meinem Inhaltsverzeichniss die Syntax rein kopiert und versucht zu ändern aber ich bekomme immer das Inhaltsverzeichniss angezeigt und darüber die Themen aber unsortiert.

Danke im Voraus

Lg Icewind

I understand your German well enough, however I am not 100% sure what you are looking for, however assuming that you have a [[word:start]] page, with all your Word related pages in this namespace (e.g. word:tutorials, word:macros, word:formatting, etc…):

Try the following markup options (or similar) in the [[word:start]] page (one or other, not both):

{{pagequery>@word *;sort=cdate;group;spelldate;proper}}

{{pagequery>@word *;sort=cyearmonth,cdate;group;spelldate;proper}}

Back in your table-of-contents/sidebar you then create a link to [[word:start|Word]]. That should do the trick.—Symon 2012-04-11

Hello, Simon,

I thought you understand German.

Me have provided the side so [ [Word] ] and not like you [ [Word:Start] ]

Your example does not function with me.

Does it lie on my sides?

Sorry for my bad English

Ich kann schon recht gut ihrer Deutsch verstehen, leider verstehe ich nicht was sie genau suchen. (Mir ist es leiber in Englische zu schreiben.)

[[Word]] ist leide keinen Raume, nur eine Wiki-seite. Um sortieren zu koennen mussen sie irgend welchen Raeume erstellen womit “pagequery” umgehen kann. Das :start koennen sie einfach wechlassen wenn es ihr lieber ist. Welche Raeume wollen sie anzeigen mittels “pagequery”?, darum geht es an…—Symon 2012-04-11

Hallo, das Problem wird sein das ich dann insgesamt nur Seiten erstellt habe und so keine Räume habe. Ich denke ich muss mein Wiki neu anlegen.

Pagequery not listing some pages

I use


to list all the pages in alphabetical order on the site front page.

Pagequery mystically lists some of the pages and some of them it skips. I haven't figured out any pattern. I did add the nocache code on the front page. I also tried the searchindex rebuild plugin mentioned here. No help.

I did change the dokuwiki url setting a couple of times during the site setup. That's the only thing I can think of anyhow related to the problem. Originally we had a problem of dokuwiki overwriting some pages. For example, the file veisto.txt was overwritten by an article with title “Veistö”. So I tried different fnencode settings to find one that understands non-ASCII articles. There was this warning that changing this might cause unexpected side-effects or something, so… could this be one of those?

Anyway, any ideas what could I do to fix this? dogma00 2012-04-19

Update: I reinstalled dokuwiki and then manually copy-pasted all the pages to the new installation (through the web pages, re-creating all the pages from scratch). Again the same problem. Not all of them are listed. But this time the non-showing pages are different. Highly annoying… dogma00 2012-04-21

I'm sorry to hear that you are highly annoyed, I suppose that I would be also after all that work! Before I begin using my own free time to begin searching for your problem (which I do not experience myself, and no other users have reported anything similar) I really would need more concrete information. I need to be able to compare your Dokuwiki page index (/data/index/page.idx) with what is listed on your screen, plus exactly what your pagequery markup is. If you would be willing to send this to my e-mail address I'll see what I can do for you.—MrBertie 2012-04-22
I don't know if the problem exists anymore for you but i had a similar problem. A few pages werent displayed. After trying around i found out that the .txt filename is not allowed to contain the word “start” if hidestart is enabled. After removing “start” from my .txt filename and reindexing of dokuwiki the pages were displayed

Grab the first image

Would it be hard to display the first image of each page listed by the pluggin ? Something like this.
It would open so much possibilities ! — Laynee 2012/06/13 20:54

Wow there is already a metadata called firstimage that is the id or url of the first image in a page!! — Laynee 2012/06/13 22:12
Did someone try to use firstimage to display the first image within pagequery? I would be interestde in using it…

— Nils 2013/02/19 22:00

This sounds possible, I could check if your display option is display={firstimage} and instead of a page link show {{link-to-first-image.jpg?200|page-title}} or similar. I'll try it out someday, or have a go yourself if you feel adventurous: start around syntax.php:549.—MrBertie 2013-02-06 22:50

Snippet for the searched text

How is supossed the ~??? snippet options should work? I tried

  {{pagequery> function;fulltext;sort=cyear,cmonth,name;group;proper;border;snippet=inline,~20}}\\


  {{pagequery>@programacion function;fulltext;sort=cyear,cmonth,name;group;proper;border;snippet=inline,~function}}

But the searched text is not displayed, just the begining of the page.

The ~??? option stops at the text or symbol specified. E.g. if your snippet is as follows:
  The deep blue sea stops at the beach, the sky at the horizon

And you used this query:

  {{pagequery> ...;snippet=inline,~sky}}

Then this would be the result:

  The deep blue sea stops at the beach, the

I.e. everything up to and not including “sky”. Hope that makes things clearer.

MrBertie 2013-02-06 22:37

Regexp in fullpage

Does the regExp work as fulltext or is limited to namespaces? I readed the documentation but I'm not sure about it. If not, it could be a cool feature for managin coding proyects.

Launch a regex (for example for functions) and see in the tooltip the function/s which match that searc chriteria.

Sorry, but the fullregex option only works for filenames. I appreciate your idea, but it would either be very slow or require a completely new full-text indexing module, which is far beyond the scope of this plugin (or even my abilities!)—MrBertie 2013-02-06 21:12

Result as Doku list

:?: I started to use this awsome plugin. One thing I want to know is how can I display the results same as doku unordered list. I want to put square dot in front of each result. Thanks.

As this is a personal taste kind of thing I would suggest that you edit the lib/plugins/pagequery/style.css file, on line:119
div.dokuwiki .pagequery ul {
    margin:0 0 8px 0;

And change list-style:none; to your preferred bullet symbol (see a CCS reference)



Hope this helps, as you're the first person to ask so I'm not going to provide an option for it (yet…)—Mrbertie 2013-03-09 13:36

— My method to make sure everything looks like dokuwiki list.

/* Important CSS to make sure Page Query shows nicely*/
div.dokuwiki .pagequery {
	font-size: 1em;
	margin-bottom: 0.7em !important;
div.dokuwiki .page .pagequery {
	margin-bottom: 1.4em !important;
div.dokuwiki .pagequery ul {
	list-style: square;
	font-size: 100%;
	margin-bottom: 0px;
div.dokuwiki .tableless {
	padding: 0px 16px 0px !important;
div.dokuwiki .page .tableless {
	padding: 0px 35px 0px !important;

James - 2014-08-24 10:37

Parameter SORT=NS causing Fatal Error

:?: Hello and thank you for this plugin!
I'm using dokuwiki Adora Belle (with around 400 pages), and would like to show an overview of all pages grouped by namespace. I have the problem, that when i use the sort by namespace option, I always get the following error and nothing is displayed:

Fatal error: Cannot use string offset as an array in /data/DokuWiki/lib/plugins/pagequery/syntax.php on line 600

All the other sorting parameters, like name, title, … work fine.
Would be great if you could help me.

Hi there, it sounds like a bug to me, I'll check this evening and push a new version once I find it. MrBertie 2013-03-27 14:46
Yes it was a bug in the group header function. It has been fixed–download the latest version. Thanks for the feedback. MrBertie 2013-03-27 20:07
Great, works perfectly now! THX a lot for the quick response!
Martin 2013-03-28 10:54

Format (Namespace) Headers

I am using pagequery to keep a pretty list of all pages in the sidebar, grouped by namespaces.


I have excluded the index pages because the group headers are already clickable where such an index page exists.

What I'm missing is the ability to format those group headers (== namespaces in my case).

  • As a minimal requirement I would like to see the titles of the namespaces (== title of namespaces' index pages) where those exist.
  • I believe some might prefer to see the namespaces' names the way they are now. Maybe you could use the display parameter for the headers as well, or introduce another parameter headerdisplay or nsdisplay for that purpose.


Sounds like a good idea, I'll look into it once I get some time. As this seems to be something unique to namespace headers perhaps nsdisplay might be the better option. Other header groups do not have meta-data available, unless you can think of another way of specifying their formatting. MrBertie 2013-04-30 13:22

I would like to list all pages from a given namespace they refer to the current page. I've the namespaces :projects and :employees and would show on each employee's page (e.g. :employees:john) the list of projects he's involved in, i.e. the start page of a project links to his page. Is this possible? The metadata array contains relation/references, but I don't see how to access it. Maybe the syntax can be like this:

{{pagequery>@:projekte start;filter=references:.;sort=title;display=title}}

Jörg Sommer 2013-10-02

I'm trying to understand exactly what you want to achieve:
    contains a link to [[:employees:john]]
    contains a pagequery {{pagequery>@:projekte...filter=references:.}} 
        which produces a list of all pages that link to this page from the :projekte namespace

I like the idea but as far as I can see in the metadata information there is no easy way to do this yet. To quote the docs:

  1. 'relation' – array
    1. 'isreferencedby' – array, list of pages that link to this page: ID ⇒ boolean exists, this is not used or written by DokuWiki core
    2. 'references' – array, list of linked pages: ID ⇒ boolean exists

I think we would need the isreferencedby metadata (i.e. pages that link to :employees:john in our example) but this is not currently used the Dokuwiki core and would have to be manually provided. So right now I do not see an easier way to do this, but I will keep looking.

MrBertie–2013-10-03 12:55

On second thoughts wouldn't backlinks be exactly what you are looking for? MrBertie 2013-10-03 13:47
Your example is right. That's what I have.

The backlinks plugin shows all backlinks. It misses the possibility to narrow the result to the pages in :projects (and to customize the link text aka. display).

I don't know the internal structure of pagequery, but don't you iterator of a list of pages (matched by the query) and filter them, i.e. for each matched page metadata['relation']['references'] might contain the page ID that's named after references:.

Only a quick try: Add metadata['relation']['references'] of the page to _build_sorting_array and in filter _filter_meta check
if ($metakey === 'references') $match = in_array($expr, $row['references'])

Jörg Sommer 2013-10-04

As I mentioned above I think (however I haven't checked thoroughly) that metadata['relation']['references'] is a list of links in the current page, not a list of backlinks, i.e. pages that link to the current page. For that we need isreferencedby which is not currently filled by Dokuwiki… however as I said, let me check. —MrBertie 2013-10-05 10:10
In _filter_meta
... = in_array($expr, p_get_metadata($row['id'], 'relation references', METADATA_DONT_RENDER))

Jörg Sommer 2013-10-05

I have thoroughly checked and like I said metadata['relation']['references'] is a list of links in the current page, not a list of backlinks to the page, so this method simply does not achieve what you are looking for.
The internal Dokuwiki backlinks function (ft_backlinks) is somewhat complicated and used the central metadata index which does contain the 'relation references' information (which is different from the page's metadata that pagequery accesses). So I'm still looking, but it's time for bed!—MrBertie 2013-10-05 22:11
The deed is done! I just pushed a new version to Github, containing 2 new filtering options: links and backlinks. They are both space-delimited lists of page ids, the first is the list of links on the page itself, the second a list of backlinks pointing to the page. Use these in a filter expression with a regex to narrow down your search. E.g.

»»> This should list all pages in :projekte that link to employees:john

Gruße MrBertie 2013-10-06 14:33
I saw that metadata refers to the current page. That's why I suggested p_get_metadata. Here's what I thought of:
--- /tmp/syntax.php     2013-10-07 14:15:06.845816304 +0200
+++ /usr/share/dokuwiki/lib/plugins/pagequery/syntax.php        2013-10-07 14:53:37.369816657 +0200
@@ -145,7 +145,7 @@
                 case 'filter':
                     $fields = explode(',', $value);
                     foreach ($fields as $field) {
-                        list($key, $expr) = explode(':', $field);
+                        list($key, $expr) = explode(':', $field, 2);
                         // allow for a few common naming differences
                         switch ($key) {
                             case 'pagename':
@@ -990,6 +990,9 @@
             $that = $this;
             $sort_array = array_filter($sort_array, function($row) use ($metakey, $expr, $exclude, $that) {
+               global $ID;
+               if ($metakey === 'references')
+                   return $exclude ^ p_get_metadata($row['id'], 'relation references', METADATA_DONT_RENDER)[$expr === '.' ? $ID : $expr];
                 if ( ! isset($row[$metakey])) return false;
                 if (strpos($metakey, 'date') !== false) {
                     $match = $that->_filter_by_date($expr, $row[$metakey]);

The extension of the explode call is neccessary to get ns:page with the filter option. Otherwise you get only the first namespace.
Jörg Sommer 2013-10-07

Did you try the new version I uploaded to Github? — MrBertie 2013-10-07 17:50

Root Directory & Filter by Section

I was fiddling around and reading the discussions and trying pagequery>@system_checklist:reports * but couldn't get it to work.

I'd like to

  1. Filter only the root directory
  2. Filter sections(#) in namespaces. eg filter=ns:animals#carnivore. Something like that.

Add "display all" function

Is there a way to make a link to display all pages after limiting the index length ? I don't want to make this link manually, because I don't know if the index list reaches the limit.

How to create a sitemap

As the internal sitemap is a function (do=index) rather than a page, I looked for a syntax or plugin that inserts a sitemap into any page (including the side bar). Using the following information, pagequery does the job


This brings up a hierarchical (tree) structure grouped by namespaces. The only missing thing compared to the internal sitemap is the group expand and collapse feature

Displaying the page namespace

:?: I would like to show the namespace of a page. When I do the following query:

{{pagequery>*;display={date:created} -- {ns} -- {title};}}

I see the literal text {ns} appear in the list rather than the page namespace. Am I missing something? Thanks ia. Jack Grahl–2014-01-29

Filter by creator

Hello, for some reason I could not filter by creator


It gave me pagequeryNo results for the search query: [query]

the filter expression returned no results.

I already put ~~NoCACHE~~ on every pages.

Thank you for your help. Bun 2015-02-13

Hello, same problem here for me :


Any clue how could I get it work if I don't know in advance the username ?

Thanks. Nada 2015-07-02

Multi-line display

Hello, can I get a multi-line display template for the “pagequery” results.

{{pagequery>[query];...;display={title} \n {description:abstract} }}

Display random page in certain criteria

Hello, could you please add the option to display a random page as a result of filtering in a namespace(s) including sub-namespaces? It would be great feature for “Page (or Quote) of the day”.

Thank you for consideration. Vitaly 2015-05-07

How to display date in german?

display={title} ({date:modified});

would display the date in english.
Kerio Connect - Neues in Version 8.5 (28 May 2015)

thanks for help. - W.Lethert 31.05.2015

setlocale(LC_TIME, 'de_DE', 'deu_deu');

Snippet Inline in a new line possible?

snippet=inline,10,l2; as snippet=inlineNewLine,10,l2;

Some duplicate entries in the list

No matter what I do, some pages are displayed twice in the list. If I sort by title first, I get more duplicates than if I sort by any other option, but either way there are always some pages that are displayed twice in the list. - jake 27.11.2015

Date in french ? and issue on page filter

Hello, first question: how to display date in french ? Second point, I want to use pagequery for displaying backlinks but some pages displayed don't have a link on my chosen page. Do you know why ?

here the code used :

{{pagequery> *;filter=links:.*playground:beatrice.*;sort=ns,title,links;group;display={title};proper;cols=3}}

I put «links» on display to verify, and here the result.

I found the reason why. Pagequery doesn't take the whole filter regex value but only the part before the ':' seperating namespace and page name.

Here the code (syntax.php)

    private function _keyvalue($str, $delim = ':') {
        $parts = explode($delim, $str);
        $key = isset($parts[0]) ? $parts[0] : '';
        $value = isset($parts[1]) ? $parts[1] : '';
        return array($key, $value);

Call with ':' as delimiter, it cuts the value part.

here is the correction (add a limit argument in explode call) :

    private function _keyvalue($str, $delim = ':') {
        $parts = explode($delim, $str, 2);
        $key = isset($parts[0]) ? $parts[0] : '';
        $value = isset($parts[1]) ? $parts[1] : '';
        return array($key, $value);

if you agree, is it possible to have an official release ? Thanks a lot.

feature request: snippet without first heading

cause we use sort=heading:asc; too, so the first heading show twice.
W.Lethert - 18.01.2017

:?: Does anyone know a way to provide a search box, where a user types in something to search for, and then gets results from Pagequery?

Eg they type “dan+monday” in a search box and it creates a search like the following:



Dan Mundy, 2017-07-21

MSH: some ideas / additions

regarding the “function getheading($ID)” in pagequery.php

I changed the function slightly

function getheading($ID) {
	$dir = "./data/pages/";
	$loc = $ID.".txt";
	$test = $dir.$loc;
	$first = "=";
	if ($file = is_file($test)) {
		$fh = fopen($test, 'r');
		$fr = fread($fh, filesize($test));
		$begstr = strpos($fr, $first, 0);
		$begstr = $begstr + 6;
		$count = strpos($fr, $first, $begstr);
		$count = $count - $begstr;
		$title = substr($fr, $begstr, $count);
		$title = $title;
	} else {
		//return "file doesn't exist";
		return false;
	return $title;

after adding the function as mentioned before, I'd recommend to change functions _render_as_html_table and _render_as_html_column


$heading = $this->_proper($heading);


$heading = ($this->getheading($heading)) ? $this->getheading($heading) : $this->_proper($heading);

in function build_sorting_array

I have a lot of pages named by date (2018-01-01 etc.) and wanted a list of sorted entries by that so I changed the function as follows

	// date sorting types (groupable)
	$dtype = $key[0];
	if ($dtype == 'c' || $dtype == 'm' || $dtype == 'n') {
		// we only set real date once per id (needed for grouping)
		// not per sort column--the date should remain same across all columns
		// this is always the last column!
		if ($real_date == 0) {
			switch ($dtype) {
				case 'c':
					$real_date = $meta['date']['created'];
				case 'm':
					$real_date = $meta['date']['modified'];
				case 'n':
					list($y, $m, $d) = array_pad(explode('-', $name, 3), 3, 0);
					if (ctype_digit("$y$m$d") && checkdate(intval($m), intval($d), intval($y))) {
						$real_date =  mktime(0, 0, 0, $m, $d, $y);
			$row[self::MGROUP_REALDATE] = $real_date;

this gives me the chance to place sort=nyear,nmonth,name and sort and group by that

I hope, I did not do it the wrong way :-)

Marcel S. Henselin (MSH) 2018-08-20

plugin/pagequery/discussion.txt · Last modified: 2018-08-20 15:14 by mhenselin