[pmwiki-users] How to list the categories a page belongs to? (fwd)

Randy randy at brownragfilms.com
Thu Feb 28 16:19:25 CST 2008


Pm's CategoryList page variable seems very handy. Unfortunately it  
didn't display anything for me.

My page simply contains:

Category: [[!Tag1]], [[!Tag2]]

(:markup:)
Categories found on this page: {$CategoryList}
(:markupend:)

and in config.php I have:
    $FmtPV['$CategoryList'] = 'CategoryList($pagename, $page)';

    function CategoryList($pagename, $page) {
      preg_match_all('/(?:^|,)Category\.([^,]+)/', $page['targets'],  
$x);
      $out = '';
      foreach ($x[1] as $n) {
        $out .= "[[!$n]] ";
      }
      return $out;
    }

Has it worked for anyone else?

Randy

On Feb 28, 2008, at 2:30 PM, Patrick R. Michaud wrote:
>>
>> Is there a way to get a list of which categories a partuclar page  
>> belongs
>> to?
>
> I suggest making a page variable for this:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20080228/19e76ba5/attachment.html 


More information about the pmwiki-users mailing list