Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Pagelist Template Samples

Summary: Custom templates for pagelists formats
Version:
Prerequisites:
Status:
Maintainer:

Sample custom formats for (:pagelist:)


fmt=#oneline

compact pagelist in one line.

[[#oneline]](:if ! equal {<$Group} {=$Group}:)
'''[[{=$Group}]] /''' \
(:if true:) | [[{=$FullName}|+]] \
[[#onelineend]]
(:pagelist fmt=PagelistTemplateSamples#oneline group=Main count=4:)

fmt=#sidebar

pagelist of titles for sidebar

[[#sidebar]](:if equal {<$Group}:)
>>fplsidebar<<
(:if ! equal {<$Group} {=$Group}:)
%sidehead%[[{=$Group}]](:if:)
* [[{=$FullName}|+]]
(:if equal {>$Group}:)
>><<(:if:)
[[#sidebarend]]
(:pagelist
fmt=PagelistTemplateSamples#sidebar
order=title group=Main count=4:)

fmt=#sidebartitles

pagelist of spaced page titles for sidebar, without group heading

[[#sidebartitles]](:if equal {<$Group}:)
>>fplsidebar<<(:if:)
* [[{=$FullName}|{=$Titlespaced}]]
(:if equal {>$Group}:)
>><<(:if:)
[[#sidebartitlesend]]
(:pagelist
fmt=PagelistTemplateSamples#sidebartitles
group=Main count=4:)

fmt=#forum

forum topics in table format

[[#forum]]
(:if equal {<$Group}:)
(:table class=forum width="90%" :)
(:cell style="background:#e5e5ff;padding-left:5px" :)'''Topic'''
(:cell style="background:#e5e5ff;padding-left:5px" :)%thd%'''Last Posted''' 
(:cell style="background:#e5e5ff;padding-left:5px" :)%thd%'''By''' (:if:)
(:cellnr style="background:#eeeeff;padding-left:5px" :)[[{=$FullName}|+]] 
(:cell style="background:#eeeeff;padding-left:5px" :){=$LastModified}
(:cell style="background:#eeeeff;padding-left:5px" :)[[~{=$LastModifiedBy}]] 
(:if equal {>$Group}:)
(:tableend:)(:if:)
[[#forumend]]
(:pagelist fmt=PagelistTemplateSamples#forum order=-time group=Main
count=4:)
Topic Last Posted By
RecentChanges August 20, 2014, at 09:41 PM tester
Test2 August 20, 2014, at 07:44 AM Profiles
Popùo June 12, 2014, at 07:34 AM Profiles
HomePage May 18, 2014, at 11:11 PM simon

  • Using the pagelist option trail=<Group>.RecentChanges:
Use this option if you want to track the same contents as the real RecentChanges and you want a quicker rendering. If you do not use this option, the pagelist directive will read every page in your group which may take some time. This may also provide different information for pages modified externally to pmwiki. In either case, some info on deleted pages will not match the real RecentChanges.
  • Setting up a group for RecentChanges:
If you want to change the layout for RecentChanges for all your groups, you can create a group called RecentChanges and insert a pagelist in the GroupHeader. This pagelist would use the group={$Name} option. Thereafter, instead of looking at Foo.RecentChanges, one would go to RecentChanges.Foo instead to see the custom RecentChanges.

fmt=#teasers

Include the first five lines of every page preceded by an edit link for that page

[[#teasers]]
|| '''[[{=$FullName}]]''' - [[Edit -> {=$FullName}?action=edit]]||

(:include {=$FullName} lines=4:)

(:if ! equal {>$Group}:)
-----
(:if:) 
[[#teasersend]]
(:pagelist fmt=PagelistTemplateSamples#teasers group=Main count=4:)
Main.AboutThisSite - Edit

PmWiki is a WikiWikiWeb system developed by Patrick Michaud as a tool to support easy collaborative authoring and maintenance of web sites. PmWiki is freely available under the GNU General Public License (GPL). See the documentation index for more information.


Main.AllRecentChanges - Edit

UpdateMe


Main.GroupAttributes - Edit

Main.HomePage - Edit

Welcome to PmWiki!

A local copy of PmWiki's

fmt=#headerinclude

Include the first paragraph. This allows a more flexible way to get teasers.

[[#headerinclude]]
%rfloat%[-more-] [[{=$FullName}|{=$Titlespaced}]]
(:include {=$FullName} para=1:)
(:if equal {>$Group}:)
(:title {$Title}:)(:if:)
----
[[#headerincludeend]]
(:pagelist fmt=PagelistTemplateSamples#headerinclude group=Main list=normal
count=5:)

more About This Site PmWiki is a WikiWikiWeb system developed by Patrick Michaud as a tool to support easy collaborative authoring and maintenance of web sites. PmWiki is freely available under the GNU General Public License (GPL). See the documentation index for more information.


more Home Page Welcome to PmWiki!


more Popùo pimomi


more Test 2 test2 hallo welt


more Wiki Sandbox Feel free to use this page to experiment with the Text Formatting Rules. Just click the "Edit Page" link at the bottom of the page.



fmt=#articleteaser

A modification of the 'teasers' template showing how css elements can be used.

[[#articleteasers]]
[+{=$Title}+]
%define=leftborder border-left="2px solid #88f" margin-left="2px" padding="0 0 0 10px"%
>>leftborder<<(:include {=$FullName} lines=5:)

%right% [-[[{=$FullName}|Read More]]-]
(:if ! equal {>$Group}:)
>><<

(:if:) 
[[#articleteasersend]]
(:pagelist fmt=PagelistTemplateSamples#articleteasers group=Main count=3:)

About This Site

PmWiki is a WikiWikiWeb system developed by Patrick Michaud as a tool to support easy collaborative authoring and maintenance of web sites. PmWiki is freely available under the GNU General Public License (GPL). See the documentation index for more information.

This site is running pmwiki-2.2.67.

Read More

AllRecentChanges

* Skins.SkinTest-Compact (diff) . . . March 14, 2013, at 07:57 PM by James Regan:

UpdateMe

Read More

GroupAttributes


fmt=#includeTitle

Include whole pages, with titles as links to the pages, separated by a horizontal rule underneath each page's content. An edit link is shown if the user is authorized as editor. The title header for each page also contains an anchor which is the same as the full page name, used for #includeToc below.

[[#includeTitle]]
(:if auth edit:)
%rfloat%[[{=$FullName}?action=edit|[-edit-]]](:if:)
!![[#{=$FullName}]][[{=$FullName}|{=$Title}]]
(:include {=$FullName}:)
----
(:if equal {>$Group}:)
(:title {$Title}:)(:if:)
[[#includeTitleend]]

For example, to include the Foo pages in a group:

(:pagelist group={$Group} name=Foo* order=title fmt=PagelistTemplateSamples#includeTitle:)

fmt=#includeToc

Build a table of contents for the included pages included by #includeTitle above.

[[#includeToc]]
* [[#{=$FullName}|{=$Title}]]
[[#includeTocend]]

So, to include all the Foo pages in a group, starting with a table of contents:

(:pagelist group={$Group} name=Foo* order=title fmt=PagelistTemplateSamples#includeToc:)

----
(:pagelist group={$Group} name=Foo* order=title fmt=PagelistTemplateSamples#includeTitle:)

fmt=#groupsWithListLinks

A bullet list of groups, with a link for listing the pages in that group.

[[#groupsWithListLinks]]
(:if ! equal {=$Group} {<$Group}:)
* [[{=$Group}]] \
  ([[list pages -> {$Name}?action=search&q=group%3D{=$Group}]])
(:ifend:)
[[#groupsWithListLinksend]]
(:pagelist group=P*
fmt={$Name}#groupsWithListLinks
count=4:)

fmt=#bygrouptitle

A list with group-names and titles (especially for a customized searchlist)

[[#bygrouptitle]]
(:if ! equal {=$Group} {<$Group}:)

:[[{=$Group}/]] /:
(:if:)
: :[[{=$Group}/[[{=$Name} | + ]]
[[#bygrouptitleend]]
(:pagelist name=E* fmt=PagelistTemplateSamples#bygrouptitle count=8:)

fmt=#includeXref

This is a generalization of the #includefaq format. Include a section from a page which has an anchor with the same name as the current page your pagelist is on.

[[#includeXref]]
(:include {=$FullName}#{$Name}:)
[[#includeXrefend]]

So, for example, if I have an anchor here:

[[#PagelistTemplateSamples]]
''Lorum ipsium...''

I do not speak Latin, dear.
[[#PagelistTemplateSamplesend]]

Lorum ipsium...

I do not speak Latin, dear.

Then I could include only that section by doing this:

(:pagelist Group={$Group} Name={$Name}
fmt=PagelistTemplateSamples#includeXref [[#{$Name}]]:)

Lorum ipsium...

I do not speak Latin, dear.


fmt=#excerpts

To include an extract of the page text around the search term, as Google does. This makes use of Cookbook:Excerpts and Cookbook:SearchQueryVariable without using Cookbook:SortByScore. You can make this format default for searches (and not pagelists, where it does nothing) by setting (:searchbox fmt=#excerpts:) on Site.Search

[[#excerpts]]
(:if ! equal {=$Group} {<$Group}:)

:'''[[{=$Group}/]]''' /:
(:if:)
: :[[{=$Group}/{=$Name}]]   {=$:Title} {=$:Summary} {=$Description}
-->%bgcolor=#DBDBDB border="1px dotted grey"%[-(:excerpts
{=$Group}.{=$Name} {$SearchQuery}:)-]%%
[[#excerptsend]]

{=$Group}? /
{=$Name}? {=$:Title} {=$:Summary} {=$Description}
(:excerpts {=$Group}.{=$Name} :)


fmt=#categorized

In order to list all pages belonging to a particular category

(:if false:)
[[#categorized]]
(:template defaults order=title:)
(:template first:)
!!! {{$$link}$Titlespaced}
(:template each:)
* [[{=$FullName}|{=$Titlespaced}]] [-({=$LastModified} -
{=$LastModifiedSummary})-]
[[#categorizedend]]
(:ifend:)

(:pagelist group=PmWiki fmt=#categorized list=normal count=6
link=Category.WikiFarms:)

(:pagelist group=Cookbook fmt=#categorized list=normal
name=-Cookbook.{*$Name} link=Category.PageList:)

Wiki Farms

Page List


fmt=#colorbydate

A simple bullet list of page names. Colored red if within last 7 days, blue if within last 30 days, green if older.

[[#colorbydate]]
* (:if date {$TodayMinus7}..{$TodayYMD}
{=$LastModifiedYMD}:)%red%(:elseif date {$TodayMinus30}..{$TodayYMD}
{=$LastModifiedYMD}:)%blue%(:else:)%green%(:ifend:) [[{=$FullName}]] modified: {=$LastModifiedYMD}%%
[[#colorbydateend]]

colorbydate requires the following lines in config.php:

$FmtPV['$TodayMinus7'] = '"' . strftime("%Y-%m-%d", $Now-(7*24*60*60)) . '"';
$FmtPV['$TodayMinus30'] = '"' . strftime("%Y-%m-%d", $Now-(30*24*60*60)) . '"';
$FmtPV['$TodayYMD'] = '"' . strftime("%Y-%m-%d", $Now) . '"';
$FmtPV['$LastModifiedYMD'] = 'strftime("%Y-%m-%d", $page["time"])';

The output would look something like this (assuming it was run on 2008-07-13):

  • Test.PageB modified: 2008-05-04
  • Test.PageC modified: 2008-05-04
  • Test.PageConfig modified: 2008-05-10
  • Test.PageListAAA modified: 2008-07-13
  • Test.PagePass modified: 2008-04-30
  • Test.Pagestore2 modified: 2008-06-14

fmt=#sidebarexpandthisgroup

An attempt to display all groups with the current group expand to show all pages. The current group and page should be highlighted. Improvements to this template would be much appreciated. Rik Blok? November 07, 2009, at 01:52 PM

(:if1 false:)
[[#sidebarexpandthisgroup]]
(:template first {=$Group}:)
(:if2 group {=$Group} :)
* %sidehead% [[{=$Group}/]]
(:else2:)
* [[{=$Group}/]]
(:if2end:)
(:template each:)
(:if2 equal {*$Group} {=$Group}:)
(:if3 name {=$FullName} :)
** (:comment Empty item so sidehead isn't applied to full list if this is first item :)
** %sidehead% [[{=$FullName}|{=$Titlespaced}]]
(:else3:)
** [[{=$FullName}|{=$Titlespaced}]]
(:if3end:)
(:if2end:)
[[#sidebarexpandthisgroup]]
(:if1end:)
(:pagelist
fmt=PagelistTemplateSamples#sidebarexpandthisgroup
count=4:)

Notes

NOTE regarding (:pagelist fmt=#group count=4:)
The fmt=group or fmt=#group looks at all of the pages in all groups, the count is not counting the groups but the pages looked at. But only the groups get displayed, not the list of pages, even the procedure looks at all groups. This is the reason it takes a lot longer on this site. -- So don't use count= with fmt=groups, and don't use it as an example, since there are so many pages on the site here.
  • This recipe requires at least PmWiki version: 2.1.beta15

See Also

Contributors

Comments

See discussion at PagelistTemplateSamples-Talk?

Edit - History - Print - Recent Changes - Search
Page last modified on February 28, 2014, at 01:13 PM