This is an old revision of the document!
Table of Contents
TagFilter Plugin
Compatible with DokuWiki
Greebo, "Frusterick Manners", "Elenor Of Tsort", Detritus
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Needed for tagadd
Installation
External requirements: This plugin requires the following additional components that must be installed separately:
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
New code is there: I fixed the download url, please update.
Examples/Usage
{{tagfilter>Status=status:.*=status:ready|Version=version:.*&nouser&nodate}}
{{tagfilter>Status=status:.*=status:ready|Version=version:.*&nouser&nodate&multi}}
{{tagfilter>Status=status:.*=status:ready|Version=version:.*&nouser&nodate&chosen}}
{{tagfilter>Status=status:.*=status:ready|Version=version:.*&nouser&nodate&multi&chosen}}
NEW TAGCOMPARE
Use tagcompare to compare tags between pages
{{tagcompare>Status=status:.*=status:ready|Version=version:.*}}
Syntax
Basic syntax:
{{tagfilter>(namespace)?(tags-filter-groups)&(flags)}}
- (namespace) defines the namespace of the filtered pages
- (tags-filter-groups) defines the different dropdown fields: Syntax (Label)=(RegExpr)=(Standard) seperated by a
|
- (Label) the dropdown-field label
- (RegExpr) a regular expression with which you can select the options for the select
- (Standard) a standard value to be selected
- (flags)
multi
enables multiselect of tagschosen
enables the chosen plugin for tag searchingcache=<seconds>
optional caching time- pagelist flags
Configuration and Settings
Admin Configuration
Option | Description |
---|---|
cache_age | How long should pages with tagfilter be cached (in seconds), 0 for no caching |
DropDownList_size | Number of items to show in classic multiple dropdown mode |
Known Bugs and Issues
ToDo/Wish List
FAQ
Development
Change Log
- Update plugin.info.txt (2023-10-21 18:56)
- Merge pull request #32 from fjf2002/patch-3 (2023-10-21 18:56)
- Merge pull request #30 from fjf2002/patch-2 (2023-10-21 18:55)
- delete filter fix (2023-10-20 16:42)
- Fix for #29 (2023-10-20 13:17)
- Update plugin.info.txt (2023-10-09 21:04)
- Merge pull request #27 from fjf2002/htmloutput (2023-10-09 21:01)
- forgot break in switch stmt (2023-10-09 10:23)
Discussion
Set header title?
Is it possible to specify the header to be something other than “tagfilter”?
Make multi search AND instead of OR
Is it possible to have the multi search be AND instead of OR?
IE, I have the following tagfilter on a page
{{tagfilter>Type=tag:typ\..*|Ethnicity=tag:eth\..*|Ingredients=tag:ing\..*&chosen&multi}}
I want to be able to select specific ingredients and only see recipes that include ALL those ingredients. Also, even though I'm using chosen, I am still getting a dropdown menu instead of a search box.
This documentation needs some serious improvement, it's not clear at all what this plugin does and how.Can you say where exactly your problem is?
First, the plugin heavily relies on the tag plugin.
To give an example: lets say you have the three pages
task:task1
==== Task1 ==== {{tag>version:v1 status:done year:2013}}
and task:task2
==== Task1 ==== {{tag>version:v2 status:open year:2013}}
and task:task3
==== Task1 ==== {{tag>version:v3 status:open year:2014}}
and define the tagfilter as followed
{{tagfilter>task:?Status=status:.*=status:open|Version=version:.*|Year=year:.*}}
now you can filter the three pages with the version, status and year tags (where the tag status:open is set on page load)I think the use of tags that have colons in your examples are confusing (to me, a noob anyway). I first was confused because I thought the colons had something to do with DokuWiki page syntax. I use a dash so my tag examples would look like: version-v3 status-open, etc.
And so my code would look like
{{tagfilter>task:?Status=status-.*=status-open|Version=version-.*|Year=year-.*}}
.. which brings me to my question & comment, which is where does a noob find the explanation of the dot (.) before the asterisk (*) syntax? .. And,As I described in the documentation it is a Regular Expression.
I'm afraid I have to agree that the documentation needs improvement. First you need a clear opening statement as to what the plugin does. Then you should have a list of the options and flags with clear statements about how each works. Then after explaining the options and flags give your examples.— Myron Turner 2015-12-18 12:39
Can you please provide an update for the latest DokuWiki release?
Is it possible to do a count of the returned pages?
Not in this version, but feel free to open a request on github - with a description how you would like to have it implemented and with example images.
Which plugin is the 'chosen' one?
Thanks for the great plugin!
I have trouble understanding the following instruction:
chosen
enables the chosen plugin for tag searching
Where have I chosen a plugin? Is it the “tagfilter” plugin? Or is “chosen” the name of another plugin, and where can I find it?
Apart from that, is it possible to apply 'chosen' and 'multi' only to some of the search field, not all?
Answer:
chosen
enables the so called Chosen Plugin, which is delivered within the tagfilter plugin. Actually it is not possible to set separate select fields as multi
or chosen
.
About RegExp support
How can I set a filter showing only certain tags ? For example, I've tried to make a filter combo showing only *HowTo* and *Faq* tags. The regexp for that would be
Filter=(howto|faq)
But that's not working. The page shows 'faq' as another filter… How could make it work ?
as |
is the seperator for the different filters it is not possible with this version of tagfilter.
Possibilities:
- rename your tags to page:howto and page:faq and work with filter Filter=page:.*
- change the separator in syntax.php
No search results
How to debug why I get no search results? I added the following line to show all tags. However, bevore and after selecting one entry, no search results are shown.
{{tagfilter>Hersteller=.*=&nouser&nodate&multi&chosen}}
What is wrong?
EDIT: I looked a bit around in the PHP Files and found, that adding the following line in ajax.php gives me a somehow running solution. I am not sure about the Namespaces, but I get results…
- ajax.php
$page_names = array(); foreach($tag_list_r as $key=>$tag_list){ $tags_parsed = $Htag->_parseTagList($tag_list, true); $pages_lookup = $Htag->_tagIndexLookup($tags_parsed); foreach($pages_lookup as $page_lookup){ // filter by namespace, root namespace is identified with a dot // root namespace is specified, discard all pages who lay outside the root namespace if(($ns == '.' && (getNS($page_lookup) == false)) || ($ns && (strpos(':'.getNS($page_lookup).':', ':'.$ns.':') === 0))) { $perm = auth_quickaclcheck($page_lookup); if (!($perm < AUTH_READ)) $page_names[$key][] = $page_lookup; } $page_names[$key][] = $page_lookup; // This line was added +++++++++++++++++++++ } }
Thanks for sharing, but your code seems bypass the ACL check, which might have security issue. The official new code's link was added in Installation section, which fixes the bug you mentioned to some degree, allowing you to filter tags without specifying namespace. But it still can not specify the root namespace, see this issue.