Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-24 20:18:39

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Stickyness w/ TXP:Newer / Older

I’m currently display my “sticky” articles via the regular process described in the FAQ. What stinks, though, is that the sticky article not only appears on the front page as a first article, but also as the first article on every other page generated via TXP:Newser / TXP:Older. Is there a way around this, i.e. put the sticky article only on the real front page / real section front page.

Cheers,
_TU

Offline

#2 2006-05-24 23:03:16

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Stickyness w/ TXP:Newer / Older

Sure: use if_individual_article or if_article_list. FAQ.


Alex

Offline

#3 2006-05-24 23:05:44

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: Stickyness w/ TXP:Newer / Older

I use if_article_list already. That’s not the problem – the sticky articles don’t appear in individual articles (and shouldn’t). Problem is, they still appear on each article list page generated by TXP:Older. But they should only appear on the first page (i.e. front).

Cheers,
_TU

Last edited by TheUsability (2006-05-24 23:06:46)

Offline

#4 2006-05-27 10:07:28

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Stickyness w/ TXP:Newer / Older

Fresh from the press: wet_if_page

Offline

#5 2006-05-27 23:40:51

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Stickyness w/ TXP:Newer / Older

Fair enough. So what’s the ideal solution here? txp:article status=“sticky” only works on the first page, by default?


Alex

Offline

#6 2006-05-28 04:55:24

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Stickyness w/ TXP:Newer / Older

Erm, a setting would be good (i.e: “show_once”?), I can see uses for the same sticky showing on every page (like section descriptions, etc).

Offline

#7 2006-05-28 12:17:39

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: Stickyness w/ TXP:Newer / Older

I’d say there should be a way to influence this, i.e. Mary’s idea – “show_once” as part of txp:article or something. Both should be possible. In my case, I only need it on the front page, others may need it on all.

wet_if_page looks promising, gonna try that – great to have been an inspiration, wet :)

Cheers,
_TU

Last edited by TheUsability (2006-05-28 19:54:42)

Offline

#8 2006-05-28 19:54:01

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: Stickyness w/ TXP:Newer / Older

Just tested it – works great!

There’s one more thing I’d like to see: A way to contain sticky articles to the front page. Right now, they always appear in their section AND on the front page. Any idea on that one?

Last edited by TheUsability (2006-05-28 19:58:04)

Offline

#9 2006-05-29 06:46:53

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Stickyness w/ TXP:Newer / Older

Use if_section? I’m not sure of what you mean so that may not be helpful…

Offline

#10 2006-05-29 07:12:19

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Stickyness w/ TXP:Newer / Older

zem wrote:

Fair enough. So what’s the ideal solution here? txp:article status=“sticky” only works on the first page, by default?

One could easily argue that this should be expanded to exclude sticky articles from search results, too. This can become quite a thicket.

Thus, I’d prefer a conditional tag over more intrinsics in txp:article. Yields flexibility, avoids pre-thought solutions which can never cover every use case.

I’ve sent a patch to add a new tag txp:if_page. If it won’t make it in the core, there’s still the plug-in. I’d just encourage to add a test for a special condition of a site into the core, as I see a natural fit there resembling if_author, if_section et al.

Offline

#11 2006-05-29 07:52:38

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Stickyness w/ TXP:Newer / Older

One could easily argue that this should be expanded to exclude sticky articles from search results, too.

Er, they already do (searchsticky parameter)?

Offline

#12 2006-05-29 07:57:05

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Stickyness w/ TXP:Newer / Older

Mary wrote:

Er, they already do (searchsticky parameter)?

No, I didn’t mean the searchable index but the results list (excerpts).

Offline

#13 2006-05-29 08:20:32

TheUsability
Member
Registered: 2005-05-03
Posts: 51

Re: Stickyness w/ TXP:Newer / Older

@mary: Again, what I wanted to do is display the sticky article ONLY on the front page, not in the respective section. Your tip w/ if_section did the trick, though, since it’s possible to select the front page with name=”“. Great, thanks!

There’s one more idea, though: Would it be possible to display the sticky article on the front page as the first one (as I do now) and get it listed in regular working order in the section? (That’s basically what I wanted to have anyway, as it turns out now.)

With my current method (if_section), the sticky article really only appears on the front page.

Cheers,
_TU

Offline

#14 2006-05-29 09:11:07

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Stickyness w/ TXP:Newer / Older

No, I didn’t mean the searchable index but the results list (excerpts).

? I’m still confused. (So what else is knew…)

Would it be possible to display the sticky article on the front page as the first one (as I do now) and get it listed in regular working order in the section?

Not by using a sticky, no. That’s because sticky articles are intended to actually be separate from the rest of the articles, like they’re a different “type” than the rest of the live articles. You’d need to make that article live and find another method to have it display at the top of the list. What purpose does the article in question serve?

Offline

#15 2006-05-29 09:23:28

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,421
Website GitHub Mastodon

Re: Stickyness w/ TXP:Newer / Older

Mary wrote:

? I’m still confused. (So what else is knew…)

Sorry. I’ll try to explain in more depth.

A plain page template (as it is shipped with txp out of the box) may contain nothing more than one single txp:article tag which does all the work (single article pages, listings, display of search results).

Now, add one sticky article in order to have a simple introduction on your site’s home page.

This sticky article is also rendered on the search results page no matter whether its content contains the search term or not. This was unexpected behaviour for me, being a novice back in the ol’ days. An article showing as the very first element of a search result list despite no matching terms are found —> Must be a bug :-(

Later on I learned about txp:if_search, which led me to the pattern I am using now and which I never questioned ever since.

Last edited by wet (2006-05-29 18:55:57)

Offline

Board footer

Powered by FluxBB