You are not logged in.
Hi I should know how to do this but I don’t use categories much so I’m wondering what the best way to go about it is.
I have a blog section that has 4 different categories on it.
There are article excerpts from these categories on various pages of the site.
If a permalink from an article is clicked I I want the blog section “landing” page to display a list of articles from the specific category that the article belonged to with a list of other articles from that category below it.
If the section link is clicked I just want it to display the most recent article from any of the categories followed by headings and category lists like this:
<txp:if_category>
<txp:article_custom category="<txp:category />" form="single" section="blog" />
<txp:article_custom category="<txp:category />" form="list" section="blog" />
</txp:if_category>
<txp:else />
<txp:if_individual_article>
<txp:article form="single" />
</txp:if_individual_article>
<txp:else />
<txp:article_custom category="upcoming-events" form="article_listing" section="blog" />
<txp:article_custom category="special-offers" form="article_listing" section="blog" />
<txp:article_custom category="tips" form="article_listing" section="blog" />
</txp:if_individual_article>
well something like that but that actually works.
Last edited by kvnmcwebn (2011-10-25 14:34:34)
its a bad hen that wont scratch itself.
photogallery
Offline
A bit of jiggery pokery with your single and double quotes, as well as improving the txp:else flow should help. Something like this maybe? (untested) :
<txp:if_category>
<txp:article_custom category='<txp:category />' form="single" section="blog" />
<txp:article_custom category='<txp:category />' form="list" section="blog" />
<txp:else />
<txp:if_individual_article>
<txp:article form="single" />
<txp:else />
<txp:article_custom category="upcoming-events" form="article_listing" section="blog" />
<txp:article_custom category="special-offers" form="article_listing" section="blog" />
<txp:article_custom category="tips" form="article_listing" section="blog" />
</txp:if_individual_article>
</txp:if_category>
You can probably be even more clever than that (e.g. the category attribute accepts a list of categories) but I’ll leave that to the tag geniuses to advise. For now that should get you moving.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
ahh i forgot about the quotes within tags. I’ll give it a go now. Thanks steph!
its a bad hen that wont scratch itself.
photogallery
Offline
steph a permlink from a different section is not going to the blog section but instead just goes to the “articles” section which I’m not even using. This is from an excerpted category from the blog section on the home page. Is there something i can do to make the permlink go to the blog section/category?
its a bad hen that wont scratch itself.
photogallery
Offline
woah that was my fault. everything working now. thanks
its a bad hen that wont scratch itself.
photogallery
Offline
ahh still not working.
<txp:if_category>
<txp:article_custom category='<txp:category />' form="single" section="picture-framers-blog-art-events-in-letterkenny-co-donegal" />
<txp:article_custom category='<txp:category />' form="list" display="9" />
<txp:else />
<txp:if_individual_article>
<txp:article form="single" />
<txp:else />
<txp:article_custom category="upcoming-events" form="article_listing" section="picture-framers-blog-art-events-in-letterkenny-co-donegal" />
<txp:article_custom category="special-offers" form="article_listing" section="picture-framers-blog-art-events-in-letterkenny-co-donegal" />
<txp:article_custom category="tips" form="article_listing" section="picture-framers-blog-art-events-in-letterkenny-co-donegal" />
</txp:if_individual_article>
</txp:if_category>
this line:
<txp:article_custom category='<txp:category />' form="list" display="9" />
seems to be getting ignored.
Last edited by kvnmcwebn (2011-10-26 18:04:47)
its a bad hen that wont scratch itself.
photogallery
Offline
display="9"? You could try limit="9" ;)
<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields
Offline
ha ha. oops.
still not the problem though. What are the other reasons why the list of articles should not display underneath the article arrived at by permlink?
its a bad hen that wont scratch itself.
photogallery
Offline
here is the article in question:
its a bad hen that wont scratch itself.
photogallery
Offline
Still don’t understand so I’m just going to make the archived events category a section.
its a bad hen that wont scratch itself.
photogallery
Offline