====== Print view ====== Creates a print view button using the do=export_html option. It's quite similar to the [[http://wiki.erazor-zone.de/wiki:projects:php:dokuwiki:print_view|Print View Button]], but it uses (action) buttons. ===== Changes ===== ==== Template.php ==== 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; ==== Design.css ==== 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 ==== Main.php ==== Next open **/lib/tpl/default/main.php** and add wherever you want the print icon to appear. For example change to And you should see your print icon appear between the edit and the history button =) \\ \\ - [[http://www.greenbird.info/dokuwiki/|Marc Troost]] 24-10-2007 ===== Discussion ===== 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(''); ptln(''); ptln(''); ptln(' '); ptln(' '); ptln(' '.$ID.''); ptln(''); ptln(''); ptln('
'); print p_wiki_xhtml($ID,$REV,false); ptln('
'); ptln(''); ptln(''); exit; }
- OTU 12-13-2007