Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-28 00:35:28

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 259
Website

if_category problems under 4.3.0?

I’ve just upgraded a site from 4.2 to 4.3, and <txp:if_category /> is drawing a blank:

I’m using the tag on a TXP ‘page’ (not a ‘form’), and it is intended to divvy up the content according to the category in the url: http://mydomain.com/?s=recognition&c=awards

Permanent link mode is ?=messy and there really are articles with Article category name = awards…

<txp:if_category name="awards">
	...
</txp:if_category>

The tag trace shows up as:

<txp:if_section name="recognition">
	[<txp:if_section name="recognition">: true]
	...
	<txp:if_category name="awards">
		[<txp:if_category name="awards">: false]
	</txp:if_category>
	...
</txp:if_section>

Anyone know why I’m not getting a category match on _ category: awards?_

Thanks all.

Offline

#2 2010-12-28 01:29:38

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: if_category problems under 4.3.0?

Seems to be closely related to this. So I think you can use a similar workaround:

<txp:php>
	// Workaround for $context bug in Txp 4.3.0 messy URL mode
	global $context;
	if ( $gps_context = gps('context') )
	{
		$context = $gps_context;
	}
	else
	{
		$context = 'article';
	}
</txp:php>

Put the above code somewhere above the if_category tag.


Code is topiary

Offline

#3 2010-12-28 02:26:23

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 259
Website

Re: if_category problems under 4.3.0?

Thanks Jeff

That did the trick.

Offline

#4 2010-12-28 02:39:28

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: if_category problems under 4.3.0?

Great.

Compact version:

<txp:php> // Workaround for $context bug in Txp 4.3.0 messy URL mode
	global $context;
	$gps_context = gps('context');
	$context = $gps_context ? $gps_context : 'article';
</txp:php>

NB: this workaround is needed only for URLs with a query string (e.g. example.com/?c=foobar), and is only needed once per page.

Last edited by jsoo (2011-01-10 23:54:08)


Code is topiary

Offline

#5 2011-03-02 17:23:15

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: if_category problems under 4.3.0?

Hello,

I have exactly the same problem with Permanent link mode ?messy

but also with rss_uc and Permanent link mode
/section/category/article/

Is there now a official patch ?

Thanks

Offline

Board footer

Powered by FluxBB