[pmwiki-users] pagelist and dynamic trail. Any suggestion ?
Pico
pmwiki at ben-amotz.com
Thu Aug 17 16:27:35 CDT 2006
Jean-Fabrice [gmail] wrote:
> Hi list,
>
> I would like to know if I'm doing the following the right way.
>
> I have a group which contains 2 kinds of page :
> - monthly pages, named Group.yyyymm
> - daily pages, named Group.yyyymmdd
>
> In a daily page, I have defined a dynamic trail to jump to the
> previous day, to the current month and to the next day. I want each
> link of the trail to be "human readable" (I don't want to use
> $FullName and I can't use $Title).
> Eg: < Monday, April 3th 2006 | April 2006 | Wednesday, April 5th 2006 >
>
> Here is how I did this :
>
> 1°/ Create variables in config.php to deduce "human readable name"
> from page's name :
> $FmtPV['$MonthLink'] = 'substr("$name",0,6)'; #To deduce the month page
> $FmtPV['$MonthLinkText'] = 'strftime("%B %Y",
> mktime(12,0,0,substr("$name",4,2),15,substr("$name",0,4)))'; #To
> create a human readable textlink for the month
> $FmtPV['$DayLinkText'] = 'strftime("%A %d %B %Y",
> mktime(12,0,0,substr("$name",4,2),substr("$name",6,2),substr("$name",0
> ,4)))'; #To create a human readable textlink for the daily page
>
> 2°/ Create a pagelist fmt which make use of these vars :
> [[#grouptrail]]
> (:if equal {$FullName} {=$FullName}:)<
> [[{<$FullName}|{<$DayLinkText}]] | [[{$MonthLink}|{$MonthLinkText}]] |
> [[{>$FullName}|{>$DayLinkText}]] >(:if:)
> [[#grouptrailend]]
>
> 3°/ Insert the trail in the daily page :
> (:pagelist fmt=#grouptrail
> name={$Group}.????????,-GroupAttributes,-Index,-RecentChanges,-AllRecentChanges,-GroupHeader,-GroupFooter
> :)
>
> NB : For the trail, I tried list=normal to get rid of non-usefull
> pages, but the trail does not show when doing that.
>
> So :
> . is 1°/ the correct / the best "PmWiki way" to do this ?
> . have you any opinion on 2°/ (which seems to work correctly)
> . can I simplified 3°/ ?
>
> thanks a lot for your help.
>
> Jean-Fabrice
>
How about define a "list=" in config.php to exclude your array of file
patterns, or, better still, to match a pattern, e.g. yyy-mm-dd
(See below for details)
Pico
----
1. PmWiki.PageLists explains:
"The "list=" option allows a search to include or exclude pages
according to predefined patterns set by the administrator.
* "list=normal" is predefined, and which excludes things like
AllRecentChanges, RecentChanges, GroupHeader, GroupFooter,
GroupAttributes, and the like from being displayed in the list results.
[snip]
* define custom lists via the $SearchPatterns array (see
Cookbook:SearchResults)."
2. Cookbook Search results says:
"Defining Custom Parameters
"PmWiki's default is to display all pages; but a wiki administrator can
override this default by adding entries to $SearchPatterns. For example,
to define "list=calendar" to limit the results to pagenames in a
yyyy-mm-dd format, an administrator can add the following to config.php:
$SearchPatterns['calendar'][] = '/\\.\\d{4}-\\d\\d-\\d\\d$/';
"With this definition, the markup (:pagelist list=calendar:) would only
display pages with names in a yyyy-mm-dd format."
More information about the pmwiki-users
mailing list