Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-04-01 17:20:30

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

you made me very happy :o)

Offline

#14 2006-04-02 12:32:46

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

rsilletti,
if I’m in an article page and haven’t searched by category, is there another way to write the value of <code><txp:category1” /></code> for the viewed article into the category attribute of this:
<code><txp:article_custom section=“therapists” category=”“ form=“nav” limit=“999” /></code>
I’m guessing using a bit of <code><txp:php></code> trickery is the only way to stop the tag breaking because of nesting txp tags…?

Offline

#15 2006-04-02 12:34:10

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

it’s basically a <code><txp:related_articles /></code> call but for articles which reside in another section is it not?

Offline

#16 2006-04-11 11:13:53

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

bumpity bump
any of you php wizards got any ideas?

Offline

#17 2006-04-11 18:14:48

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: list articles in current category, but another another section

<txp:if_category>

<txp:else />

<txp:php>echo article_custom(array(
	'section'  => 'therapists',
	'category' => category1(array()),
	'limit'    => '999',
	'form'     => 'nav'
));</txp:php>

</txp:if_category>

:)

Offline

#18 2006-04-12 07:22:02

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

thanks Mary

that didn’t quite work… it outputs all articles from the therapists section – regardless of category.

To be sure – maybe me originally saying “in a /section1/?c=category list page” gave the wrong impression ;)
I ‘ve since abandoned that approach, and I’m now trying to generate the list in an article page – so I need to use the category1 value of the current article to generate my list. Should your suggestion work in that context?

Offline

#19 2006-04-12 18:19:20

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: list articles in current category, but another another section

Unless I’m missing something here you could use my little trick to create category links within articles that generate the category list within the section you are viewing (which ordinarily would make them section sensitive) but then separate the page template code for the listing from the rest of your page code and use an article_custom tag which isn’t section-sensitive like so:-

<code>
<txp:if_category>
<txp:article_custom limit=“20” form=“formName” />
<txp:else />
This is where your existing page code resides
</txp:if_category></code>
<br />

Does that work?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#20 2006-04-13 07:18:55

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

hello fellow Stuart

What I want to generate is a list of articles which share the same <code><txp:category1 /></code> value as the current article (but which live in another section).

What I think your suggestion does is generate a link to the category listing page for the <code><txp:category1 /></code> value (but within another section). Or am I getting the wrong end of the stick?

ps.
One bit I don’t quite follow… what does the <code><txp:if_category></code> conditional do if you ddon’t supply it with a <code>name=”“</code> attribute – I thought it always needed one?

cheers ears

Offline

#21 2006-04-13 09:16:22

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: list articles in current category, but another another section

Yes, you are correct that my little trick keeps the generated category list within the same section as the link that was clicked and normally this would result in a category list that is section-sensitive because the listing would use the “article” tag contained in the page template code, and the “article” tag is section-sensitive.

Using <code><txp:if_category></txp:if_category></code> without specifying a category name simply says “if we are in a category list do this”, so what my code is saying is “if we are in a category list use the article_custom tag, else, use the normal page code”. The article_custom tag isn’t section-sensitive so it should generate a category list with aticles from all sections.

Of course this is all theory until you try it. ;)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#22 2006-04-13 09:42:03

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

Cool, that makes sense about <code><txp:if_category></txp:if_category></code>.

I tried it out, but it’s not quite what I’m after.
I need to generate my list in an article page, rather than a category list page.
And the list should contain links to other articles, not category lists.
The only part the category needs to play is that the current and linked articles need to share the same <code><txp:category1 /></code> value. The best way I can describe it is it’s like a <code><txp:related_articles /></code> call but for articles which reside in another section. Hope that makes sense!

sorry to be a pain – your suggestions are much appreciated :)

Last edited by pieman (2006-04-13 09:42:33)

Offline

#23 2006-04-13 19:25:42

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: list articles in current category, but another another section

Aha! Now I see. Have a look at this plug-in. It states:-

Can restrict the article list to the current section or any number of specified sections

Does that sound more like what you require?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#24 2006-04-14 07:50:43

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list articles in current category, but another another section

Stuart, you nailed it!
much obliged for the help everyone =)

Offline

Board footer

Powered by FluxBB