You are not logged in.
I struggled for a while to find a solution for how to list links to all other articles in the same category as the current article being viewed. Here’s how it can be accomplished using just the built in TextPattern tags.
In an article form insert:
<txp:if_article_category name="yourcategory" number="1"> <ul> <txp:article_custom form="sub" category="yourcategory" sortby="Posted" sortdir="asc" /> </ul> </txp:if_article_category> </code> And then your article form (in this case called 'sub') for listing links to other articles can be something like this: <code> <li><txp:permlink><txp:title /></txp:permlink></li>
Last edited by Case (2005-10-28 12:52:33)
Forget your dreams
Maybe off the topic but these examples are great for starters like me, thanks to everyone that contributes :)
Seeing as it’s been over a year since the last post to this thread, here’s hoping I’ll get a response!
I’d like to do the above but without having to specify my category, but default to a variable. i.e. “yourcategory” in all cases above would be “currentcategory”. Or to put it another way, “$thiscategory”. Can I do that? Do I need to access $GLOBALS somehow (can that even be done any longer)?
Ideally the code would be something like
<txp:if_article_category name="<txp:category1 />">
<txp:article_custom form="related_articles" sortby="Title" sortdir="asc" section="performers" name="<txp:category1 />" />
but that doesn’t work since the nested tags get processed as HTML (or ?)…
Last edited by linkingarts (2006-12-29 20:49:32)
I think pointing you to http://forum.textpattern.com/viewtopic.php?id=18593 would be helpful – I believe asy_wondertag can help you do that.
sweet, thanks! Seems to be working (with a bit of tweaking)
Sorry, I’m novice, thus I don’t quite catch the reason of additional form and why to name each category/subcategory. My code is simple:
<code><txp:if_article_category><txp:recent_articles limit=“10” break=“dd” label=“Other articles in the series <txp:category1 />:” labeltag=“dt” wraptag=“dl class=‘toc’” /></txp:if_article_category></code>
But I am looking for structured TOC of a current category (like in Drupal Book), e.g. how to display contents of subcategory (Category2) with only one link to the parent category1. Or a list of articles in a current category1, if the current article does rest in a subcategory.
Welcome to txp