PageLists-Talk
Discussion of PageLists
Is it possible to select pages by on criteria e,g, select=-ctime
, and display in a different order e.g. order=-name
? Sort of like (:pagelist select=-ctime count=5 order=-name fmt=fmt:)
?
You can add a custom function that reorders a list after slicing it, according to a new reorder=
argument:
$FPLTemplateFunctions['myPageListReorderAfterSlice'] = 410; function myPageListReorderAfterSlice($pagename, &$matches, $opt) { # only enable when there are both order= and reorder= and they are different if(! @$opt['reorder'] || !@$opt['order'] || $opt['reorder'] == $opt['order']) return; $page = array(); $opt['order'] = $opt['reorder']; $opt['=phase'] = PAGELIST_PRE; PageListSort($matches, $opt, $pagename, $page); $opt['=phase'] = PAGELIST_POST; PageListSort($matches, $opt, $pagename, $page); $matches = array_values($matches); }
Then in the page, use something like this. --Petko
!!!! Recently modified 5 pages, ordered by title: (:pagelist group=Main order=-time count=5 reorder=title:) |
Is it possible to use wildcard characters (?, *) in arguments? Many of the other paramteres permit them.
If by "arguments" you mean "search terms": No, they do not accept wildcard characters, but using a space instead of the wildcard may return very similar results. See Site.Search for what is possible as search terms.
What about the searchresult directive?
It is said, that ...
- The
(:searchbox:)
directive generally accepts the same parameters as(:pagelist:
) and(:input search:)
directivesThe(:searchresults:)
directive generally accepts the same parameters as as(:pagelist:)
and(:input text:)
directives
Shouldn't the latter be changed to
- The
(:searchresults:)
directive generally accepts the same parameters as as(:pagelist:)
and(:input search:)
directives
MFWolff January 22, 2021, at 07:18 AM]
Yes, thanks MFWolff, now updated. Actually, I misread/misunderstood what the sentence said -- it said that the directives accept parameters like on input element, while in my head I read it as "it is a pagelist with an input text element", so I corrected it to "input search element" which is it now. In fact, both "input text" and "input search" accept exactly the same parameters so the original phrase was not incorrect. "Input search" is a semantic field so that search engines and screen readers can know that it is about searching, not for example collecting user information. --Petko January 22, 2021, at 07:41 AM
Possible tricky bug found. Look how to catch it:
Go to WikiSandbox, press Edit and enter the following code:
!!!Not working: :PHP-cookbook: phLessCompiler.php (:pagelist fmt=#title $:PHP-cookbook=- wrap=none :) !!!Working OK: :PHPcookbook: phLessCompiler.php (:pagelist fmt=#title $:PHPcookbook=- wrap=none :)
Now press Preview. You will see only second "pageslist" working correctly. Now press "Save and edit", then press Preview again. You see, both "pageslists" working now. If you want to repeat bug, first "delete" WikiSandbox.
I think that's because of "dash" in first PTV. I know it looks like small useless bug, but in my system there are much more strange effects related to this, that I even can't formally discribe.
Finar August 29, 2019, at 12:30 PM
Indeed, there is a bug that will be fixed for the next version. In the mean time you can add to your config.php this line. --Petko August 29, 2019, at 03:18 PM$PageListArgPattern = '((?:\\$:?)?\\w[-\\w]*)[:=]';
When I use $pagevar=Keyword
param, is there any way to make it ignore first letter case? e.g. for $pagevar=Keyword
and $pagevar=keyword
return the same result. | Finar May 17, 2019, at 03:09 PM
It appears to do this for the Latin alphabet, both for page variables like $Title and for page text variables like $:SomeVariable, it finds both uppercase and lowercase matches. For Cyrillic alphabet it appears to work with a comma like $:pagevar=буква,Буква
or $:pagevar=*уква
. --Petko May 17, 2019, at 07:26 PM
(:pagelist Параметры :)
== (:pagelist параметры :)
, but (:pagelist $pagevar=Параметры :)
!= (:pagelist $pagevar=параметры :)
. Probably is there an easy way to fix it in the core? Otherwise, yes, I already use your advice about combining $:pagevar=буква,Буква
, but is makes me to build such complicated things like:
PhQuery:"*{(tolower "{$?query}")}*,*{(ucfirst "{$?query}")}*" (:pagelist $Title={$:PhQuery} fmt=#local-search-news group=News : )
Finar May 19, 2019, at 11:16 AM
I've fixed this for 2.2.116, you can get it from ChangeLog to test it -- only scripts/pagelist.php changed. See also $PageListVarFoldFn
. --Petko May 21, 2019, at 05:35 PM
(:pagelist $Title="*{$?query}*" fmt=#local-search-news group=News :)
Thank you very much!
order=$:pagetextvarname sorts decimal PTVs in alphabetical order (1,10,100,1000, etc). Is there a way to make it order by digital value?
See CustomPagelistSortOrder and CustomPagelistSortOrderFunctions although the latter needs updating as explained in the former. --Petko July 11, 2018, at 08:52 PM
Or, you can get the latest pagelist.php from Subversion or from the pre-release zip file, and try as documented in $PageListSortCmpFunction
. --Petko July 12, 2018, at 09:32 PM
Pagelist of ~1k pages takes alot of MarkupToHTML time. How to paginate pagelist results (just as in Search?action=search&q=pmwiki%2F)? Why it doesn't enabled by default?
The one enabled here is mine, but I haven't found the time to clean it up and publish it. Please see Cookbook:BreakPageList for another implementation. --Petko July 11, 2018, at 12:24 PM
(:searchresults:)
- navbar omitting search GET request and lefts only p=# in pagenum links
This appears to mostly work, all parameters "group", "list", "$:Maintainer" are in the "q=" request and re-appear in the search box. This was enabled here to prevent accidental server outages when someone uses a too broad search term with thousands of pages, for example [1]. If you have many search parameters, your list will usually be shorter -- and as you stuck enough to know the parameters we do assume your good faith. :-) --Petko July 11, 2018, at 05:37 PM
(:searchresults:)
- navbar omitting search GET request :D, current PmWiki search pagination works better :D BlacK? July 11, 2018, at 05:51 PM
How can I configure my site to always exclude wiki-related pages from searches?
Add list=normal
to the searchbox or searchresults directives
Try the following in your local/config.php file. See also Cookbook:SearchPatterns.
## Exclude Certain pages / groups from search results. $SearchPatterns['default'][] = '!\\.(All)?Recent(Changes|Uploads|Comments)$!'; $SearchPatterns['default'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!'; $SearchPatterns['default'][] = '!\\.(Left|Right|Side)(Bar|Menu|Note)$!'; $SearchPatterns['default'][] = '!^Site\\.!'; $SearchPatterns['default'][] = '!^PmWiki\\.!';
If you add $SearchPatterns['default']...
to exclude groups and pages from pagelist and search output, you can include the omitted pages by using "list=all" in the pagelist or search parameters.
How do I turn on wiki word spacing in page lists?
Try the following in your Site.LocalTemplates
---- !!!fmt=#simplelist Simple list of page names, without the Group name. [@ [[#simplelist]] [[{=$FullName}|{=$Titlespaced}]], [[#simplelistend]] @]
How to list only pages that have their title (*not* name) starting with A, B, C,...
(:pagelist $Title=A*,B*,C* :)
How do I search for pages changed by an particular author?
It would be useful to provide Author= (similar to name= or group=).
Try using the Cookbook:AuthorContribution recipe.
This recipe provides a way to automatically keep a list of the pages each author has edited by producing an "Author Contributions" page with a name of Profiles.<author's name>-Contrib for each author that has a page in the Profiles group.
Contributions by authors without profile pages are placed in a single Profiles.Other-Contrib page.
You may try pagelist using $LastModifiedBy variable, as in : (:pagelist / list=normal group=-PmWiki $LastModifiedBy=-X:)
or (:pagelist / list=normal group=-PmWiki $LastModifiedBy=X:)
to print the list of pages last edited by all but X or edited by x (Petko's pagelist).
How to exclude deleted pages from (:pagelist trail=Site.AllRecentChanges fmt=#title count=15 order=-time :)
Use (:pagelist trail=Site.AllRecentChanges if="exists {=$FullName}" ...:)
order=ctime displays the pages in the order they were created. Is there a way to reverse this (so that the newest page appears first)?
Yes. Use order=-ctime
(note the "minus").
How to we access the ctime variable, eg to display it?
Create a page variable in config.php :
$FmtPV['$PageCreationDate'] = 'strftime("%Y-%m-%d", $page["ctime"])';
and you can display it in a page with {$PageCreationDate}
in format yyyy-mm-dd
A pagelist excludes the current page from the generated list if "list=normal", how can the current page be included while retaining all the other benefits of using "list=normal"?
Set in config.php this:
If you want to be able to use both behaviors, set this in config.php:
$SearchPatterns
['normal']['self'] = "";
$SearchPatterns
['normalself'] = array(
'recent' => '!\.(All)?Recent(Changes|Uploads)$!',
'group' => '!\.Group(Print)?(Header|Footer|Attributes)$!');
Then use list=normalself
on pages that should include themselves in the results.
Is it possible to return a list of all pages that are not protected by the site password?
Perhaps Cookbook:PagelistAuthListShort might help.
I want to list all the pages in a wikigroup dynamically, how do I do that?
You can use: (:pagelist group={*$Group} :)
to list pages in the current Group. See PageVariables (note the "*" in {*$Group}).
How do I search for pages changed after a particular date?
...
Using pagelist with the link-parameter causes on Strato an "Internal Server Error:"
I had a similar error on Free.fr due to a local misconfiguration of PHP4. Switching the website to PHP5 solved the issue. As Strato supports different versions of PHP4 and 5, you should try all and tell us if/when it works. (Read the FAQs: you need to rename your index.php to index.php5, or add in your /.htaccess the code: "AddType application/x-httpd-php5 .php
"). --Petko February 16, 2008, at 08:35 PM
How do I capture the output from "fmt=count" into a page text variable?
Is it possible to find backlinks to all pages in a group, or multiple pages?
eg (:pagelist group=Cookbook link=Category/:) or (:pagelist group=Cookbook link=Category/One,Category.Two:) or (:pagelist group=Category link=Cookbook.*:)
No, see and vote for 00908 Enhance the link parameter of page list (multiple and exclusions)
Can I pass a named parameter to a pagelist, eg a number to set a thumbnail size?
For example (:pagelist fmt=#randomimage px=80:)
so that the parameter value can be referenced withing the page list template?
Yes, in the same way as documented here IncludeOtherPages#includevariable
How can I include backlinks to pages which only link to current page via pagelist? i.e page "A" has a pagelist which generates a list of links to "B","C","D" ... a backlinks pagelist on page "B" does not list page "A" because there is no REAL link from "A" to "B".
YOu might like to support and vote for 01203 Backlinks to incorporate pagelists, redirect, and include or 01204 pagelist frontlinks
Is it possible to get a list of pages that are not backlinked, eg (:pagelist link=-Category.EnterpriseArchitecture ... :)
No, negation on the link=
parameter is not currently supported, but you can use PageListMultiTargets
Is there a variable containing the search term that can be used in pagelists, etc?
Add the following line to your local/config.php file:
insecure, use HttpVariables.
Now, you can use the $FmtPV
['$SearchQuery'] = 'stripmagic(@$_REQUEST["q"])'; {$SearchQuery}
variable wherever you wish...
In a pagelist you can have the request=1 argument which will then work as if the search terms were typed into the directive. --Petko
How can I list also Pages that are read protectet?
Add to config.php $EnablePageListProtect
= 0;
How can I in the pagelist get all the data (include the date and time and author) from the AllRecentChanges and RecentChanges pages?
You can use a custom pagelist template that, for each page on the trail, examines the page variables of the page being processed: {*$LastModified}
and {*$LastModifiedBy}
. You might also consider using a recipe such as Cookbook:TextExtract.
Is it possible to search for pages with nogroupfooter set?
Yes, just type nogroupfooter in the search form, or place it in a pagelist markup like (:pagelist group=Main nogroupfooter:)
. --Petko April 28, 2021, at 05:15 AM
Is it possible to pagelist for all pages a username edited, and sort by last time the user edited them ?
See Cookbook:AuthorContribution which configures a RecentChanges page per user, when there is a profile page for the current author. Once installed and the user has made some more edits, you can indeed use that in a (:pagelist trail=Profiles.Gnuzoo-Contrib fmt=#simple:)
. --Petko
This is a talk page for improving PmWiki.PageLists.