Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-12-15 14:18:12
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Truncate Titles
Hey guys, I did a quick search for this and everything that came up was circa 2005, so I thought I would ask again…
What is the best way to truncate titles in my default page?
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
Re: Truncate Titles
I think sab_substr could do that for you.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Truncate Titles
Probably, rvm_substr is a little better than the one suggested by Stuart.
Offline
Re: Truncate Titles
Or rvm_substr, which might be better as it’s newer and understands that splitting in the middle of an XHTML tag is bad…
EDIT: Maniqui had faster fingers :-)
Last edited by Bloke (2008-12-15 14:55:31)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2008-12-15 15:08:24
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Re: Truncate Titles
ha… interesting how it works, so for like, this block of code:
<h4>Previous Articles</h4>
<div id="prevart"><ul><txp:rvm_substr length="50"><txp:article_custom section="article" limit="20" sortby="Posted" sortdir="desc" form="recentarticles" /></txp:rvm_substr></ul></div>
It actually limits the entire list to 50 characters, rather than each iteration…. doh!
Last edited by Zodiac (2008-12-15 15:09:33)
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
#6 2008-12-15 15:14:17
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Re: Truncate Titles
Can you append the rvm_substr to each list element? Like, in the txp:article tag?
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
Re: Truncate Titles
Yes. You should enclose the <txp:title />
tag in your form to do what I think you want.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#8 2008-12-15 15:22:07
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Re: Truncate Titles
I list like, previous entries and some of the titles are longer than the sidebar, so they wrap, and wrap, and wrap… and I’d rather just replace the ends with a … and be done with it.
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
#9 2008-12-15 15:35:15
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Re: Truncate Titles
thebombsite wrote:
Yes. You should enclose the
<txp:title />
tag in your form to do what I think you want.
hmmm… I am confused by what you mean…
Can you show me an example?
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
Re: Truncate Titles
In your form template called “recentarticles” you should wrap the title tag something like:-
<txp:rvm_substr length="50"><txp:title /></txp:rvm_substr>
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#11 2008-12-15 15:48:01
- Zodiac
- Member
- Registered: 2005-04-22
- Posts: 26
Re: Truncate Titles
DuH!
Yes of course… very nice…
It sort of works, ha, it looks like 35 characters means different things to different titles, but it works!
Thanks guys!
Special Order 937: “Nostromo Rerouted To New Coordinates. Investigate Life Form. Gather Specimen. Priority One. Insure Return Of Organism For Analysis. All Other Considerations Secondary. Crew Expendable.”
Offline
Re: Truncate Titles
The character limit includes spaces, punctuation etc.
Offline
Pages: 1