[pmwiki-users] (:pagelist :) : need to filter by strange stuff

Marco Ferretti marco.ferretti at gmail.com
Fri Jun 9 15:55:24 CDT 2006


On Friday 09 June 2006 22:24, Martin Fick wrote:
> > What the BlogSimple cookbook does is it creates
> > wikipages that are named
> > Group.yyymmdd-<real name>; BlogArchive uses the new
> > naming filtering  capabilities
> > of (:pagelist:) adding a name filter that is
> > "yyyymm*" thus  listing pages in a
> > month ( namely the blogs )
> >
> > My constraints are :
> > page name is Ryyyy-nnnn
>
> What does the nnnn stand for?
Unique number in the year : an ID
>
> > this way I can't use the same "trick" to get the
> > pages created during a  specific
> > month.
>
> Because it is not part of the filename?
exactly
>
> > Now, you are saying that I can use a page variable
> > in order to filter. Since  I
> > created my own reciepe to create these pages, I can
> > add any page variable  I need.
> > My question is : provided I have a page variable
> > named YMonth that holds the  year
> > and month of creation of the page, what would the
> > (:pagelist:)  directive look like
> > to list, for example, pages created during January
> > 2006  ?
>
> What format would this variable be in?  Something like
> "yyyymm"?
That was just ment as an example but , yes you got it !
>
>
> You can create a pagelist template and use
> conditionals in the template which could filter out
> any page that you don't care about, but you may not be
> able to do it with the current conditionals.  You may
> need to either define your own or use
> Cookbook/ConditionalExtensions.
>
> Then read the section on pagelisttemplates.  Create a
> simple template say:
>
> [[#custom]]
> (:if equal {=$customvar} 200601 :)
>
> : :[[{=$Group}/{=$Name}]]
>
> (:if:)
> [[#customend]]
>
>
> If your format is more complex and you cannot do an
> exact equals match, you may need to define a custom
> conditional such as (untested!):
>
> $Conditions['regmatch'] = 'RegMatchArgs($condparm)';
>
> function RegMatchArgs($arg) {
>   $arg = ParseArgs($arg);
>   return preg_match(@$arg[''][0], @$arg[''][1]);
> }
>
>
> Say your format included the day: yyyymmdd
>
> Use (:if regmatch /yyyy..dd/ {$custom_var}:)
>
> The Cookbook/ConditionalExtensions will allow you to
> do greater-than and less-than conditions, this might
> be helpful.  It would be nice to see a regmatch type
> condition added to that extension. :)
>
> Hope that helps,
It really does help ! 
Thanks a lot !!
>
> -Martin
>
Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/pmwiki-users/attachments/20060609/adc4c9b1/attachment.bin 


More information about the pmwiki-users mailing list