Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Trouble creating a renderer plugin
Avatar
zioth #1
Member since Jul 2011 · 77 posts
Group memberships: Members
Show profile · Link to this post
Subject: Trouble creating a renderer plugin
Can anyone tell me what I'm doing wrong? My renderer plugin won't run, and I don't think it's loaded at all. If I add an obvious syntax error, it doesn't interfere with Doku's rendering.

The filename is renderer.php. It's in the top level directory of my plugin. The code roughly looks like this:

<?php
if (!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_INC . 'inc/parser/xhtml.php';

class renderer_plugin_mypluginname extends Doku_Renderer_xhtml {
    function canRender($format){
        return $format == 'xhtml';
    }

    function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') {
        return 'BAD PLUGIN!';
    }
}
Avatar
LarsDW223 #2
Member since Sep 2014 · 370 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
I think you need to configure it under config option renderer_xhtml.
Avatar
zioth #3
Member since Jul 2011 · 77 posts
Group memberships: Members
Show profile · Link to this post
Thanks! That worked.

Renderer plugins would probably be more useful if they could stack on top of each other like syntax plugins. I want to override internallink. That shouldn't prevent someone else from overriding externallnk. Oh well.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-01-17, 20:37:18 (UTC +01:00)