[dokuwiki] Re: preventing instruction level caching

  • From: Michael Klier <chi@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 29 Apr 2009 11:38:06 +0200

On Wed, Apr 29, 2009 at 09:31:06PM +1200, James Lin wrote:
> 
>     If I were you I'd used either TPL_ACT_RENDER or TPL_CONTENT_DISPLAY,
>     because in
>     those two you can modify the actual page XHTML without the cache getting 
> in
>     your way at all. Rendering just one piece of plugin syntax could be done
>     using
>     p_render(), in your case the syntax of the indexmenu.
> 
> 
> great, that sounds awesome, I was pulling my hair how to make use of the
> indexmenu syntax in TPL_CONTENT_DISPLAY or TPL_ACT_RENDER events,
> 
> could you please give me some code sample on how to use the p_render() method?

To output the XHTML of some syntax:

$syntax = '{{indexmenu>....}}';
print p_render('xhtml', p_get_instructions($syntax), $info);

Note: This is an "expensive" operation as it instantiates a new renderer for
each p_render() call. Using it for sth. like you want to achive shouldn't be a
problem though as you problably only call it once in your plugin.

HTH,
        Chi

-- 
Michael Klier

www:    http://www.chimeric.de
jabber: chi@xxxxxxxxxxxxxxxxxx
key:    http://downloads.chimeric.de/chi.asc
key-id: 0x8308F551

Other related posts: