txp:category1 & txp:category2 · Monday December 19, 2005 by Gerhard Lazu
Although Alex said that both txp:category1 and txp:category2 are section specific, I believe that this little hack is necessary.
Imagine you have a section called Men’s Clothing and, one of the many categories is Trousers. Let’s say your visitor is browsing a certain item in Men’s Clothing > Trousers. You have there a <txp:category1 /> that you think it will re-direct him/her to http://yoursite/mens-clothing/?c=trousers (or http://yoursite/mens-clothing/category/trousers if using clean cat support). Well, since categories are section independent, <txp:category1 /> will produce http://yoursite/?c=trousers (or http://yoursite/category/trousers if using clean cat support). Enter my hack:
In textpattern/publish/taghandlers.php modify lines 1054-1055:
return '<a href="'.pagelinkurl(array('c'=>$thisarticle['category1'])).'">'.
$cat_title.'</a>';
change to
return '<a href="'.pagelinkurl(array('s'=>$thisarticle['section'],'c'=>$thisarticle['category1'])).'">'.
$cat_title.'</a>';
Same thing for lines 1071-1072. Just don’t forget to use category2 instead of category1. Et voila, problem sorted. Then again, it might not be a problem for you in the first place.
<< Where was your Mac and/or iPod built? ... zem_article_info() >>