Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-22 22:37:57

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

pgonly="1" in txp:article tag on individual article pages

…displays the article. Is this intended behaviour?

Offline

#2 2009-06-25 17:55:47

lothar99
Member
Registered: 2009-03-20
Posts: 35

Re: pgonly="1" in txp:article tag on individual article pages

The txp error is appearing in a <pre> tag. If that could be hidden it could hide the errors. Is there any way to hide pre tags on pages?

I tried

pre {
visibility: hidden;
}

but it didn’t work =(

Offline

#3 2009-06-25 21:19:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: pgonly="1" in txp:article tag on individual article pages

Do you mean the notice about the missing article tag? Your css solution probably doesn’t work because the output is before the css is called. Couldn’t you solve it by setting the production status to ‘live’?

But thanks for bumping this thread ;) I’d still like to get an answer to my question.

Offline

#4 2009-06-26 04:25:58

lothar99
Member
Registered: 2009-03-20
Posts: 35

Re: pgonly="1" in txp:article tag on individual article pages

When I set to live mode it breaks a plugin I use: rvm_privileged. It only works in debugging/testing modes in Firefox(and maybe others) and I don’t know why =(!

Offline

#5 2009-06-28 11:21:43

lothar99
Member
Registered: 2009-03-20
Posts: 35

Re: pgonly="1" in txp:article tag on individual article pages

I found a workaround…. but I’m not sure if there is still a way for people to see the protect content.

I did this:

css:

#hide {
visibility:hidden;
}

below my footer in the code:

<div id=“hide”>
<txp:article />
</div>

The article doesn’t appear, and I don’t see it in view pagesource either, but is there any other way people might get around the visibility:hidden ?

edit:
#hide {
display:none;
}

works better actually, no blank space where article would have been

Last edited by lothar99 (2009-06-28 11:34:59)

Offline

#6 2009-07-01 21:22:09

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: pgonly="1" in txp:article tag on individual article pages

I wrote:

Is this intended behaviour?

Maybe I should have said: is pgonly="1" supposed to work only on article list pages?

I’m still curious… :)

Offline

#7 2009-07-01 22:36:01

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: pgonly="1" in txp:article tag on individual article pages

Els wrote:

Maybe I should have said: is pgonly="1" supposed to work only on article list pages?

If I have understood your question correctly I suppose that yes – from a logical point of view pgonly should work only on article list pages.
When in a single article page txp fetches only a single specific article from the “textpattern” table so the article count would always be equal to 1.
On the other hand when in article list pages txp fetches all the articles that belong to a specific section (as well as other conditions defined when txp:article is called) so the article count result could be equal to 1.

Last edited by redbot (2009-07-01 22:37:47)

Offline

#8 2009-07-01 22:41:06

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: pgonly="1" in txp:article tag on individual article pages

Although it makes sense for pgonly to work only on article list context, I think it would be nice that a <txp:article pgonly="1" />, when on individual article, returns nothing, to be more consistent.
If not, we will need to wrap <txp:article pgonly="1" /> on conditional tags.

But I may be missing something, not seeing the whole picture that devs usually see.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#9 2009-07-01 23:28:42

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: pgonly="1" in txp:article tag on individual article pages

maniqui wrote:

… I think it would be nice that a <txp:article pgonly="1" />, when on individual article, returns nothing, to be more consistent.
If not, we will need to wrap <txp:article pgonly="1" /> on conditional tags.
But I may be missing something, not seeing the whole picture that devs usually see.

Ah ok thanks, I have finally understood what the issue was.
I’m not sure about your solution though: why would one want to have an individual article page with no article displayed?

Offline

#10 2009-07-01 23:42:46

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: pgonly="1" in txp:article tag on individual article pages

redbot wrote:

why would one want to have an individual article page with no article displayed?

That’s exactly what I was thinking, so I can sort of understand why I didn’t get any replies at first :) But someone found a reason to use pgonly="1" on an individual article page…

And it just made me wonder why actually it doesn’t work – though it makes perfect sense – because I’ve always assumed that all pgonly="1" meant was: ‘check if there are articles but don’t display them’. Not being a coder, I’m probably totally wrong about that ;)

Offline

#11 2009-07-02 00:27:29

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: pgonly="1" in txp:article tag on individual article pages

Els wrote:

That’s exactly what I was thinking, so I can sort of understand why I didn’t get any replies at first :) But someone found a reason to use pgonly="1" on an individual article page…

Ok you are right, I didn’t think of such a special case.

And it just made me wonder why actually it doesn’t work – though it makes perfect sense – because I’ve always assumed that all pgonly="1" meant was: ‘check if there are articles but don’t display them’. Not being a coder, I’m probably totally wrong about that ;)

I think is something only slightly different like: ‘count fetched articles (so you can paginate) but don’t display them’.

Offline

#12 2009-07-02 08:43:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,391
Website GitHub

Re: pgonly="1" in txp:article tag on individual article pages

redbot wrote:

‘count fetched articles (so you can paginate) but don’t display them’.

Correct. If you’re using an article tag (not article_custom) and your articles are not sticky, pgonly will simply set up the pagination info and then return nothing.

I can’t for the life of me see why it would act differently on an individual article page to an article list page. I’ll have to dig a little deeper because — as Els linked above — the warning about no article tag on a page is a bit of a headache when using ign_pw_protect to lock away content.

It’s also a pest when creating an image gallery directly in a Page template. I often find that if I want visitors to go to site.com/gallery and see artwork, I have to create one article and put it in the ‘gallery’ section, then put the gallery tags — often Textile escaped or with Leave page untouched set — either directly in the article, or create an article Form. That’s a whole lot of unnecessary cruft just to work around this TXP “feature”. Plus it means I then have two URLs to the same content site.com/gallery and site.com/gallery/my-artwork… not that it’s a problem of itself, but it’d be nicer to just have one.


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

Board footer

Powered by FluxBB