Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
Re: if_category problems under 4.3.0?
Thanks Jeff
That did the trick.
Offline
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
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