DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:renderer_plugins

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
devel:renderer_plugins [2015-01-14 14:42]
176.63.181.50 [Synopsis]
devel:renderer_plugins [2016-07-31 17:08] (current)
Klap-in fix pointer to gitorious
Line 44: Line 44:
 To make the plugin's export mode accessible to the wiki user, add a button or link somewhere using a [[devel:Syntax Plugins|syntax plugin]] or [[devel:Action Plugins|action plugin]]. To create the correct link you should use the [[xref>exportlink|exportlink()]] function. To make the plugin's export mode accessible to the wiki user, add a button or link somewhere using a [[devel:Syntax Plugins|syntax plugin]] or [[devel:Action Plugins|action plugin]]. To create the correct link you should use the [[xref>exportlink|exportlink()]] function.
  
-When your plugin creates a different output format than ''text/html'', you need to set all needed HTTP headers in the metadata of the page. This is best done in the [[xref>document_start|document_start()]] method of your renderer. Here is an example from the [[plugin:ODT]] plugin (''[[http://gitorious.org/dokuwiki-odt/dokuwiki-odt/blobs/master/renderer.php|odt/renderer.php]]''):+When your plugin creates a different output format than ''text/html'', you need to set all needed HTTP headers in the metadata of the page. This is best done in the [[xref>document_start|document_start()]] method of your renderer. Here is an example from the [[plugin:ODT]] plugin (''[[https://github.com/LarsGit223/dokuwiki-plugin-odt/blob/master/renderer/page.php|odt/renderer/page.php]]''):
  
 <code php> <code php>
Line 50: Line 50:
     ...     ...
     ...     ...
 +    $filename = noNS($ID) . '.odt';
     $headers = array(     $headers = array(
         'Content-Type' => 'application/vnd.oasis.opendocument.text',         'Content-Type' => 'application/vnd.oasis.opendocument.text',
-        'Content-Disposition' => 'attachment; filename="'.noNS($ID).'.odt";'+        'Content-Disposition' => 'attachment; filename="' . $filename . '";'
     );     );
     p_set_metadata($ID,array('format' => array('odt' => $headers) ));     p_set_metadata($ID,array('format' => array('odt' => $headers) ));
devel/renderer_plugins.txt · Last modified: 2016-07-31 17:08 by Klap-in