Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-09 16:19:35

KB
Member
Registered: 2006-03-13
Posts: 21

Modify list of Recent article depending on chosen category

Hi,

I have 5 categories in my <a href=“http://www.vassar.info/b/tp/”>blog</a>.

My goal is, that when I click on one of the catgory, to limit the list of recent article (under the label “Latest) in the right sidebar to the chosen category.

I tried to insert
<code>
<!— experimental —>

<txp:if_category name=“Books-and-movies”>
<txp:recent_articles label=”“ category=“Books-and-movies” limit=“30” break=“br” wraptag=“br”/>
</txp:if_category>

<!— experimental —>
</code>
followed by the original
<txp:recent_articles label="" limit="30" break="br" wraptag="br"/>

But as you can see on the blog, the two delimiters (…) show on the page but there is nothing in between and only the old (original) listing shows. Pls help, thanks.

(edited to show code. -Els)

Last edited by els (2006-04-09 17:49:12)

Offline

#2 2006-04-09 16:20:47

KB
Member
Registered: 2006-03-13
Posts: 21

Re: Modify list of Recent article depending on chosen category

Sorry, I can’t see the code in my post. How can I make it show?

Offline

#3 2006-04-09 17:46:35

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

Re: Modify list of Recent article depending on chosen category

I edited your post to show the code. Use < code > < /code > (without the spaces) or @ ‘s.

How do I post tags and code on the forum?

Last edited by els (2006-04-09 17:48:35)

Offline

#4 2006-04-09 18:03:12

KB
Member
Registered: 2006-03-13
Posts: 21

Re: Modify list of Recent article depending on chosen category

Thank you for help with posting. Now I hope I can get help with my original question…

Offline

#5 2006-04-09 18:07:26

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

Re: Modify list of Recent article depending on chosen category

First, wraptag="br" is not possible, you’d better change it into wraptag="p" (this should be a container tag, that can be wrapped around something, like <p>...</p>).

Second, if you want the original recent articles list not to show if you’re on a category page, change your code into something like this:
<code><txp:if_category name=“Books-and-movies”>
<txp:recent_articles label=”“ category=“Books-and-movies” limit=“30” break=“br” wraptag=“p” />
<txp:else />
<txp:recent_articles label=”“ limit=“30” break=“br” wraptag=“p” />
</txp:if_category>
</code>(add the separator yourself, I’m not sure where you want it)
You can also leave the label attribute out if you don’t need it.

Otherwise I don’t see a reason why it shouldn’t work.

Offline

#6 2006-04-09 19:02:10

KB
Member
Registered: 2006-03-13
Posts: 21

Re: Modify list of Recent article depending on chosen category

Thanks for your reply. I did insert the code you suggested.

So when I click on the “Books & movies” category, the list of recent articles does not change. The posts themselves (in the ‘content’ part of the page) do change appropriately, in that the 5th most recent post (‘Don’t exaggerate’) becomes the first listed.

How can I make the ‘Latest’ list update?

Offline

#7 2006-04-09 19:20:00

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

Re: Modify list of Recent article depending on chosen category

Hmm… I don’t get it. The recent articles list is there twice now, both on the home page and on the category page. Can you please post the exact code you have in between Latest and Search?

Offline

#8 2006-04-09 19:32:44

KB
Member
Registered: 2006-03-13
Posts: 21

Re: Modify list of Recent article depending on chosen category

I realize it may be confusing….
When I edit the page I generally insert the new code between markers, and leave everything else unchanged. When everyhting works OK I remove the old code. So ther are two lists now, but the new code is between markers ie. ‘…’. The second listing is the original. At your request here is the code:

<code><p><b>Latest</b>

<!— experimental —>

<txp:if_category name=“Books-and-movies”>
<txp:recent_articles label=”“ category=“Books-and-movies” limit=“30” break=“br” wraptag=“p” />
<txp:else />
<txp:recent_articles label=”“ limit=“30” break=“br” wraptag=“p” />
</txp:if_category>

<!— experimental —>

<p><txp:recent_articles label=”“ limit=“30” break=“br” wraptag=“br”/></p>
</code>

The problem is not the duplication of recent articles listing, but rather that the newly added list (the 1st one) does not change when I choose a category.

Offline

#9 2006-04-09 19:53:37

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

Re: Modify list of Recent article depending on chosen category

I see, so we can concentrate on the ‘experimental’ code. It looks like only the tag after <txp:else /> is used, even on the category page. I can honestly see no reason why it wouldn’t work. Are you sure there is no typo in the category name? If for instance in content > organize the category name is books-and-movies, then it’s possible that category=“Books-and-movies” won’t work.

Offline

#10 2006-04-09 19:55:12

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

Re: Modify list of Recent article depending on chosen category

This may sound totally non-technical and I’m not suggesting it is THE solution but I’ve had little problems with this before. Try changing Books to books.


Stuart

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

Offline

#11 2006-04-09 20:02:44

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

Re: Modify list of Recent article depending on chosen category

This time <strong>I</strong> won, Stuart :)))

Last edited by els (2006-04-09 20:03:24)

Offline

#12 2006-04-09 20:06:23

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

Re: Modify list of Recent article depending on chosen category

Shall I delete mine then? :)


Stuart

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

Offline

Board footer

Powered by FluxBB