Textpattern CMS support forum
Article list inside an article?
I have a section in a site called About Us. Within this, I have an article titled News Room. I have a number of articles within a News category. What I’d like to do – and so far it ain’t happening – is to basically have the News Room page display the news headlines with excerpts; sort of like a landing page that you’d find if you clicked a section name.
I’ve tried this form within the subpage template with no luck. What I was hoping this would do is have TXP display headlines IF it’s on the News Room article within the About Us section… if not, then display regular formatting for individual articles in other sections.
<txp:if_individual_article> <txp:if_article_category name="News"> <txp:article_custom form="nsa_newsHeadlines" category="News" section="About-Us" /> <txp:else /> <txp:article form="nsa_singleArticle" limit="1" /> </txp:if_article_category> </txp:if_individual_article>
The code displays regular articles in other sections so that works fine. However, on the News Room article page, it’s blank. The source code shows an H1 tag that SHOULD contain the page title but it’s empty.
Has anyone tried doing this before? I’m sure it’s not uncommon and I feel I’m going about this all the wrong way.
(Edit: updated thread subject. -Mary)
Last edited by Mary (2006-10-04 13:17:58)
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Article list inside an article?
if_article_category only works from an article form, not a page. You should also use a seperate page for your About Us section – that will make it simpler not to have it mess up in other sections.
On your page:
<txp:if_individual_article> <txp:article form="news_list" /> </txp:if_individual_article>
Then, in your form, news_list:
<txp:if_article_category name="News"> <txp:article_custom section="About-Us" category="News" form="nsa_newsHeadlines" /> <txp:else /> <!-- put the _contents_ of nsa_singleArticle here --> </txp:if_article_category>
Does that make sense?