Recent Topics

1 Jun 07, 2012 19:13    

I'm looking for an example renderer or some documentation on how to create a renderer.
The page http://manual.b2evolution.net/Renderer_Plugin just seems to go round and round in circles finishing with a broken link.

Is there a skeleton class with everything defined that just allows me to override the bits I need with some instructions of what each bit does.

Any help will be greatly appreciated.

2 Jun 07, 2012 20:13

All you need is to add methods like these and modify $params['data']

"Render" events are called once and the content is saved to DB
RenderItemAsHtml
RenderItemAsXml
RenderItemAsText

"Display" events are called on each page view
DisplayItemAsHtml
DisplayItemAsXml
DisplayItemAsText

Example


	/**
	 * Event handler: Called when rendering item/post contents as HTML.
	 *
	 * Note: return value is ignored. You have to change $params['data'].
	 *
	 * @see Plugin::RenderItemAsHtml()
	 */
	function RenderItemAsHtml( & $params )
	{
		$params['data'] = 'TEST['.$params['data'].']TEST';
	}



	/**
	 * Event handler: Called when displaying item/post contents as HTML.
	 *
	 * Note: return value is ignored. You have to change $params['data'].
	 *
	 * @see Plugin::DisplayItemAsHtml()
	 */
	function DisplayItemAsHtml( & $params )
	{
		$params['data'] = $params['data']."\n<br />-- test_plugin::DisplayItemAsHtml()";
	}


Form is loading...