Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
section-aware recent articles
I want to do a list of recent articles that is section-aware (when i’m in section dogs, it will only show recent articles on dogs, when i’m in section cats only articles on cats, etc).
I’m aware i can do this with txp:article and conditional tags, but it becomes cumbersome if you have many sections to do, and you have to edit every time a section is added
if section=cats
(display cats recent articles)
/if
if section=dogs
(display dogs recent articles)
/if
if section=birds
(display birds recent articles)
/if
etc…
ideally, i’d like to just throw in a tag that says “display the most recent articles from the CURRENT section”
any trick, hack or plugin to do this?
thanks :)
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
Re: section-aware recent articles
I’m not sure I understand what you are asking for. Would <code><txp:section /></code> help? See in <a href=“http://textpattern.net/wiki/index.php?title=Txp:section_/”>textbook</a>
Last edited by colak (2006-04-18 13:16:47)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#3 2006-04-18 13:34:11
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: section-aware recent articles
With chh_article_custom you can use section="?"
, meaning the current section.
Offline
Re: section-aware recent articles
:D thank you els, that’s exactly what i was looking for :)
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
Re: section-aware recent articles
kemie wrote:
I’m aware i can do this with txp:article and conditional tags, but it becomes cumbersome if you have many sections to do, and you have to edit every time a section is added
if section=cats
(display cats recent articles)
/if
if section=dogs
(display dogs recent articles)
/if
if section=birds
(display birds recent articles)
/if
ideally, i’d like to just throw in a tag that says “display the most recent articles from the CURRENT section”
Hola kemie,
i think you can achieve that in the most simple way without using conditional (if_section) tags nor plug-ins.
A simple <txp:article />
in your page template will output only the articles from the current section because that tag is context-sensitive.
Play with the limit and form/listform attributes to control the output.
Maybe, you will want to wrap the tag with <txp:if_article_list></txp:if_article_list>
because (if not) you will run into troubles when in individual_article context (individual article will show twice).
But that issue also has a possible solution: <txp:article form="empty" listform="mylistform" />
.
Then you create an empty form. So, when in article-list context, it will show articles using the form “mylistform“and when in individual-article, it will show nothing.
Saludos!
Offline
Re: section-aware recent articles
julian, thanks. that makes a lot of sense. but i do want to have the list even when i’m in an individual article page. so i guess the plugin is the answer.
gracias!
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
Pages: 1