[pmwiki-users] using ReadPage (was "rss feed marked up to html")

Patrick R. Michaud pmichaud at pobox.com
Fri May 7 09:20:46 CDT 2010

On Thu, May 06, 2010 at 11:56:18PM -0700, Maria McKinley wrote:
> Hello there,
> See if rephrasing my question helps. I am currently suing this code by Roman:
> $FeedFmt['rss']['item']['description'] = 'FeedText';
>   function FeedText($pagename, &$page, $tag) {
>     $p = ReadPage($pagename);
>     $content = MarkupToHTML($pagename, $p['text']);
>     return "<$tag><![CDATA[$content]]></$tag>";
>   }
> I was wondering if there is someway to limit the array that is
> returned by ReadPage, do that it only pulls the content up to
> >>div1end<<[[#blogend]]?

Try the following instead:

    function FeedText($pagename, &$page, $tag) {
        $text = RetrieveAuthSection($pagename, '##blogend');
        $content = MarkupToHTML($pagename, $text);
        return "<$tag><![CDATA[$content]]></$tag>";

The '##blogend' argument says to read from the beginning of the page
to just before the line containing the [[#blogend]] marker.  See
http://www.pmwiki.org/wiki/PmWiki/IncludeOtherPages for more information
about the section specifications.

This version won't read text from pages that are read-protected;
if you want to get text even from read-protected pages, then 

        $text = RetrieveAuthSection($pagename, '##blogend', NULL, 'ALWAYS');

Hope this helps!


More information about the pmwiki-users mailing list