Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Create printable pages?
Could I bother the TXP gurus for the best way to create printable pages?
I’m guessing it involves creating a stylesheet dedicated to printing. But what’s the quickest way to load an article or section in that stylesheet by clicking on a “printable page” version?
Thanks,
Ann
Offline
Re: Create printable pages?
And by “version” I mean button. :)
Offline
Re: Create printable pages?
Let’s say that when ?print=1
is set to the URI, page is shown with print style. First lets create a simple link which… well changes the link:
<a href="?print=1">Print</a>
Now we need little conditional code for loading the CSS:
<txp:variable name="print" value='<txp:php> echo gps("print"); </txp:php>' />
<txp:if_variable name="print" value="1">
<link rel="stylesheet" type="text/css" media="all" href="<txp:site_url />print.css" />
</txp:if_variable>
- See variable
- See if_variable
- Bookmark Tag Reference
But if you just want to add CSS for browsers’ prints, then you can use media="print"
to target the CSS. No links and conditionals required for actual print styles.
Offline
Re: Create printable pages?
Thanks!
Offline
Re: Create printable pages?
If you also specify a print style sheet on the normal page, you don’t need a separate page for printing, you can just print the “normal” page and it will use the print style sheet.
Offline
Pages: 1