Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-03 17:50:56

Kachii
New Member
Registered: 2008-05-03
Posts: 4

Related Articles List Not Working

I’ve tried using default examples such as:

<txp:related_articles label=“Related” limit=“5” />

And with specific sections like:

<txp:related_articles section=“about” />

And also tried using PHP to display a list of articles from the current section like:

<txp:php>
echo related_articles(
array(‘section’=>$GLOBALS[‘pretext’][‘section’])
);
</txp:php>

(at least I presume that’s how you would do the above).

But none of them display anything at all (I do have multiple articles in the same section and apart from that they do appear correctly). I would ideally like to display an unordered list of the articles in the current section.

Can anyone help?

Thanks in advance.

Offline

#2 2008-05-03 18:06:25

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Related Articles List Not Working

txp:related_articles will give you articles in the same category, not section. For showing articles in the same section you’d better use txp:article_custom. Together with asy_wondertag you could use it like this:

<h3>Related articles</h3>
<ul>
<txp:asy_wondertag>
<txp:article_custom section="<txp:section />" form="related_articles" />
</txp:asy_wondertag>
</ul>

Form ‘related_articles’:

<li><txp:permlink><txp:title /></txp:permlink></li>

Last edited by els (2008-05-03 18:08:41)

Offline

#3 2008-05-03 18:42:44

Kachii
New Member
Registered: 2008-05-03
Posts: 4

Re: Related Articles List Not Working

Thank-you Els, works perfectly. :)

Offline

Board footer

Powered by FluxBB