Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-01-18 01:50:11

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Section does not pick up assigned page

I have a Print link in my article form:

<a href=”<txp:permlink />&s=print”>Print</a>

The Section named “print” is assigned a Page named “4g_print” which contains a barebones printable format.
Section “print” is also assigned a Style named “print” with some minimal CSS in it.

Messy URLs are on.

When clicked, the Print link produces a URL like:

http://www.mysite.com/index.php?id=13428&s=print

but the page does not appear with the 4g_print page layout. Instead it appears with just the ordinary individual article form and default page.

This worked in the previous version of TXP used on this site, which was several versions before the current one. I have just upgraded to 4.5.5 and everything else appears to work. I’d appreciate any advice.

Last edited by sunmaker (2014-01-18 02:07:04)


All boundaries are for practical purposes only.

Offline

#2 2014-01-18 03:39:07

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Section does not pick up assigned page

Recently we had a similar question in the forum.

First: There is no need for a own print page (section). You can do all what you need for the print directly in the CSS, for example, the screen styles you declare inside of “@media screen { … }” and the print styles inside of “@media print { … }”.

Second: It seems to me that the logic in your explanation is not the logic how Textpattern works. If you want to show an article assigned to a section inside of a page from an other section (print), then you need in the print section page something like:

<txp:article_custom id="13428"> … </txp:article_custom>

Question to all: How to surround this? The following <code>@media screen { … }</code> (proposed here) doesn’t work.

Offline

#3 2014-01-18 11:47:28

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Re: Section does not pick up assigned page

It’s not clear to me how using a media query would address the need. CSS alone can’t cause TXP to display an individual article, accompanied by special print-only HTML such as a banner and a copyright notice. A page template is needed to do those things.

In our case, articles on the home page are assigned the section Home, but if the user clicks Print on any article, that article must then display as an individual article using the print section, print page and print style.

The previous message you cited suggests that the ability to show an article in a different section with the ?s= attribute was removed in 4.5.5.

I did not see that in the changelog and would appreciate a pointer as to where that is mentioned and why it was removed.


All boundaries are for practical purposes only.

Offline

#4 2014-01-18 15:26:29

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Section does not pick up assigned page

sunmaker wrote #278260:

I did not see that in the changelog and would appreciate a pointer as to where that is mentioned and why it was removed.

Here it is.

Offline

#5 2014-01-19 15:44:55

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Re: Section does not pick up assigned page

OK. Well, that does not really say why it was removed or what site developers are supposed to do in its absence.

Perhaps it was deemed a security risk. I welcome some alternative, using native tags.

We need a permlink that displays an article using a specified page and style, regardless of the section the author chose for that article at time of publication.

ExpressionEngine is often compared with TXP. In EE, for example, one can direct a permlink to display an article using any page and form desired.


All boundaries are for practical purposes only.

Offline

#6 2014-01-19 16:14:03

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Section does not pick up assigned page

Hi

Txp works his own way!

In your example the link:

http://www.mysite.com/index.php?id=13428&s=print

There is a solution using the plugin adi_gps,

put this code in the “print” page:

<txp:adi_gps quiet="1" />
<txp:article_custom id='<txp:variable name="id" />'><txp:body /></txp:article_custom>

then the article with the desired id is showed.
The code is not tested but should work, txp can do a lot of things when you know how it works and play with some plugins.

Cheers.

Offline

#7 2014-01-19 17:23:24

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Re: Section does not pick up assigned page

Thank you. I have adi_gps installed and active.

I have not been able to get your suggestion to work. The result is the same as before: the individual article is shown with the default section instead of the print section.

The print section -> print page and print style.

In the default page:

<a href="<txp:permlink />&s=print">Print</a>

The print page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>MySite</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<txp:css format="link" /></head><body>
<p>From www.mysite.com</p>
<txp:adi_gps quiet="1" />
<txp:article_custom id='<txp:variable name="id" />'>
<h1><txp:title /></h1><txp:body />
</txp:article_custom>
<p id="dateline">Posted: <txp:posted format="%d %b %Y" /></p>
<p style="font-size: smaller">Copyright 2006&ndash;<txp:php>echo date("Y");</txp:php> Author of site.</p></body></html>

Last edited by sunmaker (2014-01-19 17:29:32)


All boundaries are for practical purposes only.

Offline

#8 2014-01-19 17:33:32

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Section does not pick up assigned page

Only <txp:adi_gps />, without quiet="1".

The link produced by <a href="<txp:permlink />&s=print">Print</a> shows the ID?

BTW: I still don’t understand why you need a separated print page. ;-)

Offline

#9 2014-01-19 17:37:40

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Re: Section does not pick up assigned page

Without quiet=“1” makes no difference.

Link produced example:

http://www.mysite.com/index.php?id=14320&s=print

The site needs a separate print page because we do not want the masthead photo on the print and because different output_form content needs to appear on the print, in addition to different CSS.


All boundaries are for practical purposes only.

Offline

#10 2014-01-19 17:59:49

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Section does not pick up assigned page

Yes, I was wrong.

It seems you don’t know the media queries screen and print.

For the images you could, four example:

@media print {
    img { display: none; }
}

… etc.

Last edited by GugUser (2014-01-19 18:46:49)

Offline

#11 2014-01-19 18:17:22

sunmaker
Member
From: Washington DC
Registered: 2005-01-04
Posts: 40

Re: Section does not pick up assigned page

CSS media queries can’t control TXP tags. The article must display with different output_forms for head, menus etc. It is not just turning off display of an image.


All boundaries are for practical purposes only.

Offline

#12 2014-01-19 18:18:30

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Section does not pick up assigned page

Ah ok i see what s happenning, you should change the link to the page to something like this:

<a href=“s=print&myid=<txp:article_id />”>Print</a>

and then change the coresponding code in print page like this:

<txp:article_custom id='<txp:variable name="myid" />'>
at GugUser: you dont need the section information when you give the id to article_custom

The problem in my previous code is: the link take you to an individual article context then txp use the section defined into the article section, that s why i changed the code to make it go to section page instead.

Offline

Board footer

Powered by FluxBB