Question
Hello.
I am a beginner TWiki user. I do have a PDF button (next to Edit, Attach) setup for
GenPDF in TWiki 4.1 but I cannot see how to do this properly in Twiki 4.2. So what I am asking about is how to add another tab at the top of a topic so that I can click on it and get it to render PDF.
I do have genPDF working in TWiki 4.2 if I write the URL by hand. FYI. It's just that last bit of polish that got me stopped.
I have looked at the support site, googled and tried myself to get this working and have not found anything fully helpful.
Would someone please update the getPDF plugin page to show exactly the coding differences that are required to do this OR add a new"view.tmpl" or whatever file that shows how to do this.
Thank You
Stephen
Environment
--
StephenHurrell - 23 Jan 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
One way to do this and to isolate the changes so you don't have to edit the distributed templates is to override the skin.
For example, create a skin called "pdf" with the following steps.
First, In the
templates directory, create a file called
view.pdf.tmpl containing:
%TMPL:INCLUDE{"view.pattern"}%
%TMPL:DEF{"display_pdf_link"}%<span><a href='%SCRIPTURL{"genpdf"}%/%WEB%/%TOPIC%' rel='nofollow' title='Generate a PDF' >PDF</a></span>%TMPL:END%
%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{"activatable_attach"}%%TMPL:P{"display_pdf_link"}%%TMPL:END%
What this does is
- includes the pattern template,
- creates a new template called display_pdf_link, and then
- overrides the top:toolbarbuttons template to add a PDF button to the right of the Edit and Attach buttons.
Then, to activate the template, assuming you are using the default pattern template, add a Set statement to the
WebPreferences or
TWikiPreferences topics.
* Set SKIN = pdf, pattern
--
GeorgeClark - 24 Jan 2008
If the last line of view.pdf.tmpl is changed to be:
%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{context="new_topic" then="" else="activatable_attach"}%%TMPL:P{context="new_topic" then="" else="display_pdf_link"}%%TMPL:END%
Then when a new topic is being created, the Attach and PDF buttons are both removed.
--
GeorgeClark - 24 Jan 2008