Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Article linking headaches
Hi all,
I’m putting together a simple site for a tennis club (also using it as part of my TXP training!) and have a real headache trying to get everything working. I’ve done numerous forum searches and has come across loads of interesting stuff, some of which looked like it could work, but so far the solution has eluded me.
Some background:- I have 8 sections and several categories such as Fixture, Coach, Social Event, Contact, etc. Some are parent categories – Fixture for example, which covers various leagues.
- On the front/home page I’m trying to list all the recent posts in title/date/exceprt form.
- On each section front page I’m trying to list the top three posts in various categories (although I need to title them appropriately, ie not necessarily using the category title as the header).
I’m using a simple article form…
<code>
<h3><txp:title /></h3>
Posted by <txp:author link=“n” /> | <txp:posted format=”%b %d, %Y” />
<p><txp:body /></P>
</code>
and list form…
<code>
<div class=“post”>
<h3><txp:permlink><txp:title /></txp:permlink></h3>
</div>
<div class=“excerpt”>
<p><txp:excerpt /></p>
</div>
</code>
So far so good.
Example page code, for say coaching…
<code>
<h3>Our Coaches</h3>
<txp:article_custom form=“cltc_article_form” category=“Coach” section=“coaching” sortby=“Posted” sortdir=“desc” listform=“cltc_list_form” />
</code>
The problem is that the article title links on the section front page don’t take me to the full article, but the same listing, although the url has changed (/coaching/27/barry-coach). If I put in the standard article code, <code><txp:article form=“cltc_article_form” listform=“cltc_list_form” /></code>, everything’s fine but that doesn’t give me any control over selectively displaying infomation.
I’m sure there’s something very elemental I’m doing wrong, but I’ve been through so many articles my brain’s beginning to hurt! I’d really appreciate some guidance.
Thanks.
Last edited by decoderltd (2006-08-04 16:33:45)
Offline
Re: Article linking headaches
article_custom doesn’t accept a listfor attribute, so you’ll need to use a conditional. Plus, it is section-independent, so you’ll need to use txp:article to display a section’s article. EX:
<pre>
<txp:if_article_list>
<!— if you’re on an article list—>
<h3>Our Coaches</h3>
<txp:article_custom form="cltc_list_form" category="Coach" section="coaching" sortby="Posted" sortdir="desc" />
<txp:else />
<!— if a single article —>
<txp:article form="cltc_article_form" />
</txp:if_article_list>
</pre>
Offline
Re: Article linking headaches
Fantastic!
Many thanks Jon-Michael, that’s the perfect solution. I spent so long trying to get it to work, I guess the Textpattern way of thinking hasn’t quite clicked yet.
One other question, what’s the best way of outputting a Parent Category – I have one called Coaching Sessions containing Improvers, etc, which I’d like to output under one heading in the same way, but from what I can see neither tag accepts the <code>parent_category</code> attribute.
Mark.
Offline
Pages: 1