Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-01-17 16:10:08
- sunmaker
- Member
- From: Washington DC
- Registered: 2005-01-04
- Posts: 40
Permlink with form attribute?
How would one achieve this?
<txp:permlink page=“print_page”>Print version of this article</txp:permlink>
It is not enough to put a print.css in the site in question, because articles have to be printed with a page template (not just a stylesheet) devoted to printing.
All boundaries are for practical purposes only.
Offline
Re: Permlink with form attribute?
Though not quite a direct answer to the question, does this topic give you any alternative approaches on how to achieve print pages?
EDIT: or perhaps:
<a href="<txp:permlink />?print=1">Print this page</a>
and then in your page flow:
<txp:adi_gps />
<txp:if_variable name="print" value="1">
// Render your page in print mode
<txp:else />
// Render your page normally
</txp:if_variable>
Last edited by Bloke (2010-01-17 16:37:26)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2010-01-17 16:54:00
- sunmaker
- Member
- From: Washington DC
- Registered: 2005-01-04
- Posts: 40
Re: Permlink with form attribute?
Thank you Stef.
I was not aware of the adi_gps plugin and will try it, unless others might have a nonplugin solution.
The thread you pointed to unfortunately does not address my situation. So far I have not been able to turn off certain unwanted styled elements of the page template using CSS in a print stylesheet.
The page template uses the YUI framework which dictates the page structure using a special stylesheet that resets the browser, establishes the font to be used, including a font scaling system, and sets up the page grid.
Although I can set certain portions of the page to display:none in a print stylesheet, I can’t affect the page structure from CSS. That is why a print page template is necessary.
I also faced this problem with an ExpressionEngine site I manage. It uses the YUI framework too. However, in EE one can create hyperlinks to articles that specify any page template you wish the rendered article to use. There, my print page template calls a print stylesheet.
I’d hope that something similar could be done in TXP, like a permlink with a page/form attribute.
Last edited by sunmaker (2010-01-17 16:56:08)
All boundaries are for practical purposes only.
Offline
Re: Permlink with form attribute?
sunmaker wrote:
I was not aware of the adi_gps plugin
It’s not strictly necessary if you want a plugin-free solution; it’s just the most convenient way of bringing URL variables into TXP variables. You could do it with a few lines of PHP if you preferred.
The crux of the approach is that, while an article must reside in a dedicated Section (with an implied Page template), using conditionals in that Page template allows you to alter what bits of markup go where. If you base this decision on some external input to the page you can effect a ‘switch’ between the two views.
You might also want to look into <txp:output_form /> and <txp:yield />. With some cunning you might be able to utilise Forms to output major segments of your page; the output_form container could pass in some switch that determines how to render that portion — e.g. ‘regular’ or ‘print’ — based on something in the hyperlink. Again, it’s not a true “alternative page” template but works in the same way. But shhhhh, don’t tell any Software Engineers that I advocated passing a value into a Form that determines the action to take or I’ll have the coupling and cohesion police on my back ;-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2010-01-17 17:53:07
- sunmaker
- Member
- From: Washington DC
- Registered: 2005-01-04
- Posts: 40
Re: Permlink with form attribute?
Nobody expects the coupling and cohesion police!
Problem solved:
<a href=”<txp:permlink />&s=print”>Print</a>
Section “print” uses a page template and stylesheet specifically for printing. Apparently TXP doesn’t care that the article to be printed is actually assigned to section “Home” …
Thank you again for the help.
Last edited by sunmaker (2010-01-17 19:41:17)
All boundaries are for practical purposes only.
Offline
Pages: 1