Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-04 16:26:21

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

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

#2 2006-08-04 17:20:32

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

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>
&lt;txp:if_article_list&gt; &lt;!— if you’re on an article list—&gt; &lt;h3&gt;Our Coaches&lt;/h3&gt; &lt;txp:article_custom form=&quot;cltc_list_form&quot; category=&quot;Coach&quot; section=&quot;coaching&quot; sortby=&quot;Posted&quot; sortdir=&quot;desc&quot; /&gt;
&lt;txp:else /&gt; &lt;!— if a single article —&gt; &lt;txp:article form=&quot;cltc_article_form&quot; /&gt;
&lt;/txp:if_article_list&gt;
</pre>

Offline

#3 2006-08-04 17:37:26

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

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

Board footer

Powered by FluxBB