Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-02 19:17:15

bluepurl
Member
From: Prairie du Sac, Wi
Registered: 2009-02-23
Posts: 42
Website

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

#2 2010-08-02 19:17:51

bluepurl
Member
From: Prairie du Sac, Wi
Registered: 2009-02-23
Posts: 42
Website

Re: Create printable pages?

And by “version” I mean button. :)

Offline

#3 2010-08-02 19:36:40

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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>

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

#4 2010-08-03 20:12:53

bluepurl
Member
From: Prairie du Sac, Wi
Registered: 2009-02-23
Posts: 42
Website

Re: Create printable pages?

Thanks!

Offline

#5 2010-08-04 09:53:29

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB