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

Martin Fick mogulguy at yahoo.com
Fri Jun 9 15:24:10 CDT 2006


> 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?

 
> 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?

> 
> 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"?


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,

-Martin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the pmwiki-users mailing list