Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2008-07-05 20:46:22

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: status in txp:article as list

…it means there’s no way to mix sticky and live articles in a list.

Take for instance that you’d like only sticky articles to show up on the front page, while you’d like them to appear amongst live ones on their section’s page. Granted, this could be achieved with categories, but still…

So, my point : allow to use status="live,sticky" in the article tag and all is solved. There’s no backwards compatibility issue whatsoever, if you keep the default to 4. Sure, it all remains a bit confusing for noobs who will have to figure out how it comes their sticky article doesn’t show up.

I’ve just upgraded a site from an older txp version in which I have exactly this situation. Now that I’ve upgraded, all the sticky articles that appear on the front page have dropped out of the menus and sitemap etc. etc. I thought this had been made possible again in the meantime, but maybe I was mistaken? I’m no longer a noob, but how does one get sticky and live articles to appear interleaved in one and the same list?

I know I could do txp:article with status is sticky, then txp:article with status is live but it’s less than ideal as the order of menu items changes, articles in sitemaps change position – that’s disorientating for the client and site visitors and I don’t even want to have to explain why.

I’m also not keen on alternative routes: I’m already using two categories and don’t really want to go the whole rss_unlimited_categories route or sacrifice a valuable custom field to simply set a “show on front page” flag? Both seem inelegant solutions to me – setting a “sticky” article was perfect.

Anyway, I’m working on a patch.

Guillaume, would you care to share your patch?


TXP Builders – finely-crafted code, design and txp

Offline

#26 2008-09-06 09:03:04

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: status in txp:article as list

It may not be very elegant but the following additions to the function doArticle enable one to have status="live,sticky" or status="4,5" without changing previous behaviour:

Add

		$stickyandlive	= in_array(strtolower($status), array('live,sticky', 'sticky,live', '4,5', '5,4')) ? true : false;

in front of line 608 of publish.php (above the line beginning $status = in_array(...

and a little further down in front of line 690 in publish.php:

		elseif ($stickyandlive)
			$statusq = ' and Status >= 4';

in front of the line beginning else

There’s probably a more elegant way of doing it. If so, let me know.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB