Learn about DokuWiki
Advanced Use
Corporate Use
Our Community
Follow us on Facebook, Twitter and other social networks.
Learn about DokuWiki
Advanced Use
Corporate Use
Our Community
Follow us on Facebook, Twitter and other social networks.
Creates a print view button using the do=export_html option. It's quite similar to the Print View Button, but it uses (action) buttons.
Open inc/template.php. Find (line 468)
case 'profile': if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $auth->canDo('Profile') && ($ACT!='profile')){ print html_btn('profile',$ID,'',array('do' => 'profile')); return true; } return false; default: print '[unknown button type]'; return true; }
and change it to
case 'profile': if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $auth->canDo('Profile') && ($ACT!='profile')){ print html_btn('profile',$ID,'',array('do' => 'profile')); return true; } return false; case 'print': tpl_link(wl($ID,'do=export_html'), $pre.$suf, 'class="action print" accesskey="p" rel="nofollow"'); return true; default: print '[unknown button type]'; return true; }
Find (line 600)
case 'profile': if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $auth->canDo('Profile') && ($ACT!='profile')){ tpl_link(wl($ID,'do=profile'),$pre.$lang['btn_profile'].$suf, 'class="action profile" rel="nofollow"'); return true; } return false; default: print '[unknown link type]'; return true;
change it to
case 'profile': if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $auth->canDo('Profile') && ($ACT!='profile')){ tpl_link(wl($ID,'do=profile'),$pre.$lang['btn_profile'].$suf, 'class="action profile" rel="nofollow"'); return true; } return false; case 'print': tpl_link(wl($ID,'do=export_html'), $pre.$suf, 'class="action print" accesskey="p" rel="nofollow"'); return true; default: print '[unknown link type]'; return true;
Next open /lib/tpl/default/design.css. Find “a.index” and copy the lines changing a.index into a.print. So
div.dokuwiki div.toolbox_sidebar a.index,
becomes
div.dokuwiki div.toolbox_sidebar a.index, div.dokuwiki div.toolbox_sidebar a.print,
And
div.dokuwiki div.toolbox_sidebar a.index { background: transparent url(images/tool-index.png) 1px 1px no-repeat; }
becomes
div.dokuwiki div.toolbox_sidebar a.index { background: transparent url(images/tool-index.png) 1px 1px no-repeat; } div.dokuwiki div.toolbox_sidebar a.print { background: transparent url(images/tool-print.gif) 1px 1px no-repeat; }
Where url(images/tool-print.gif) is you print icon.
[...]
Do the same for the other instances of a.index
Next open /lib/tpl/default/main.php and add
<?php tpl_button('print')?>
wherever you want the print icon to appear. For example change
<?php tpl_button('edit')?> <?php tpl_button('history')?>
to
<?php tpl_button('edit')?> <?php tpl_button('print')?> <?php tpl_button('history')?>
And you should see your print icon appear between the edit and the history button
- Marc Troost 24-10-2007
The do=export_html option does not use the print.css when you view it on the screen so what you print out can look very different.
Using export_xhtml as a base, I added export_print to inc/actions.php under function act_export($act) This will use the print.css for print view on screen. Hopefully, someone with more programming skill can put all these together into a nice action plugin.
// Printable View if($act == 'export_print'){ global $conf; global $lang; header('Content-Type: text/html; charset=utf-8'); ptln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'); ptln(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'); ptln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$conf['lang'].'"'); ptln(' lang="'.$conf['lang'].'" dir="'.$lang['direction'].'">'); ptln('<head>'); ptln(' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'); ptln(' <link rel="stylesheet" media="all" type="text/css" href="/wiki/lib/exe/css.php?s=print" />'); ptln(' <title>'.$ID.'</title>'); ptln('</head>'); ptln('<body>'); ptln('<div class="dokuwiki export">'); print p_wiki_xhtml($ID,$REV,false); ptln('</div>'); ptln('</body>'); ptln('</html>'); exit; }
- OTU 12-13-2007