[dokuwiki] exclude pages from feeds

  • From: Muayyad AlSadi <alsadi@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 2 Jan 2011 17:02:36 +0200

Hi,

I made something I want to share so that it would be reformed into a patch,

I need to exclude some pages from feeds (eg. sidebar and sidebar2
because they are used by our template)

I've done this using

function endswith($heystack, $needle) {
    $l=strlen($needle);
    return $needle===substr($heystack, -$l, $l);
}

and just below $id   = $ditem['id'];
I've added

            if (endswith($id,"sidebar") || endswith($id,"sidebar2")) continue;

and I have some name spaces I want to exclude from the feeds (because
we give this to tweeter)
so I made a general x_ns (exclude name spaced)

function startswith($heystack, $needle) {
    $l=strlen($needle);
    return $needle===substr($heystack, 0, $l);
}

...

    if (isset($_REQUEST['x_ns'])) $x_ns=explode(",",$_REQUEST['x_ns']);
    else $x_ns=array();

...

            foreach($x_ns as $x)  if (startswith($id,$x.":"))
{$skip=true; break;}
            if ($skip) continue;


what do you think ?
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: