[pmwiki-users] Trouble with rss feeds
Petko Yotov
5ko at 5ko.fr
Mon Sep 3 13:42:05 CDT 2012
Ian MacGregor writes:
> ## Function to include the body text in the rss feed
> function MarkupExcerpt($pagename) {
> $page = RetrieveAuthPage($pagename, 'read', false);
> return substr(@$page['text'], 0, 200);
> }
...
> Each blog page starts with:
> (:toc-float:)
> (:title Blog Layout Update :)
> (:Summary: Blog layout update :)
...
> The feed is working great except that it's also pulling in the top of each
> page (:toc-float:) (:title Blog Layout Update :) (:Summary: Blog layout
> update :), due to the MarkupExcerpt function, and I don't want those in my
> rss feed.
>
> What do I need to do in order to have the rss feed not include things like
> (:toc-float:) (:title Blog Layout Update :) (:Summary: Blog layout update :)
> in the rss feed? I'm assuming I need to edit the Markup Excerpt function in
> some way.
Instead of RetrieveAuthPage(), it may be better to use IncludeText.
If you want to extract from line 4 to the end for example, use this:
function MarkupExcerpt($pagename) {
$text = IncludeText($pagename, "$pagename lines=4..");
return substr($text, 0, 200);
}
You can also use "$pagename lines=4..6" if you want to only include lines 4,
5 and 6 for example.
There are more than one ways to do it, if you want to define what will be
shown from the page, you could wrap it with [[#exerpt]]...[[#excerptend]]
and call the function RetrieveAuthSection($pagename, '#excerpt') instead of
RetrieveAuthPage().
Petko
More information about the pmwiki-users
mailing list