Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-21 07:16:23

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Shorten Recent posts/comments

I’d like to shorten the recent_articles, recent_comments lists:
Articles with long titles can make the recent_articles list look messy.
I’d like to shorten them, e.g. defined by a number of characters or words. Or even present the article’s ID instead (combined with the option below).
The same in recent_comments: if an article has a long title, the list is really messy.
An optimal solution could provide the whole title as an alternate text or tooltip showing the whole title when you hover on the link.

As I got into it so far there is no out-of-the-box-way of tweaking it like this.
Does anyone already have a solution or know what to do?

Offline

#2 2009-04-01 02:43:20

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: Shorten Recent posts/comments

i’m looking for a way to do this too. the only thing that comes to mind is the obvious rss-auto-excerpt plugin but i think it only works on post content

Offline

#3 2009-04-01 18:07:02

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

Re: Shorten Recent posts/comments

The recent_comments tag can be used as a container tag, so rvm_substr should be able to help you there.
I’m not sure if it can be used with recent_articles, but if not, you can easily replace that tag with article_custom.

Offline

#4 2009-04-01 18:15:04

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Shorten Recent posts/comments

Wow, thank you! (I nearly started to feel overlooked on that one :-) but I know everyone is busy and some things aren’t easy. waiting was worthwhile! )

Sounds very reasonable and I’ll try that out as soon as I got rid of an exhibition I have to design/manage and am back on the computer again. (Should be on next monday evening, if I can resist to try before).

Offline

#5 2009-04-01 18:58:09

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Shorten Recent posts/comments

couldn’t resist = true ;-)

But unfortunately just on the site I could use it most (loooong titles) I’m currently using rah_recent_comments for paginating long lists of comments.
So a short try couldn’t start now. Have to wait.

But maybe someone could help me to get clear the following: There isn’t any default form for recent_articles or recent_comments? The current behaviour is set in the core? Or do I overlook something?
And by using it as a container I can replace the default?

Last edited by saccade (2009-04-01 18:58:41)

Offline

#6 2009-04-01 19:03:12

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: Shorten Recent posts/comments

Els wrote:

The recent_comments tag can be used as a container tag, so rvm_substr should be able to help you there.

worked like a charm. thank you as usual

Offline

#7 2009-04-01 19:07:51

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Shorten Recent posts/comments

@mrtunes
Great! Can you post the code you used?

Offline

#8 2009-04-01 19:09:27

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: Shorten Recent posts/comments

saccade wrote:

@mrtunes
Great! Can you post the code you used?

<txp:permlink><txp:rvm_substr length=“25”><txp:title /></txp:rvm_substr></txp:permlink>

Offline

#9 2009-04-01 19:12:52

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

Re: Shorten Recent posts/comments

saccade wrote:

There isn’t any default form for recent_articles or recent_comments?

Recent_articles just displays the permlinked article titles (this is hardcoded, it doesn’t use a form). By using article_custom instead you can do the same, or more :)

Recent_comments as a single tag works similarly, not using a form either. But now that it can be used as a container tag, you can make it display anything you want.

Offline

#10 2009-04-01 19:21:22

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Shorten Recent posts/comments

Ah, ok, I see.
So if I’d want to get the current behaviour – but with shortened titles – I’d do it like this:

<txp:permlink><txp:comment_name /> (<txp:rvm_substr length=“25”><txp:title /></txp:rvm_substr>)</txp:permlink>

I’m not sure about the comment_name-part, as that could be a link in certain circumstances (if mails open) and will possibly break the whole thing. The default behaviour includes the name in the article’s permlink.

Anyway – many thanks to you, Els and mrtunes!

Offline

#11 2009-04-01 19:24:55

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: Shorten Recent posts/comments

Sorry, stupid me, of course I could solve this like that:

<txp:permlink><txp:comment_name link="0" /> (<txp:rvm_substr length=“25”><txp:title /></txp:rvm_substr>)</txp:permlink>

Offline

Board footer

Powered by FluxBB