Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-07-06 02:49:30
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
adi_title - Abbreviated titles
Summary
adi_title will output an abbreviated version of an article’s title.
Usage
You can use <txp:adi_title />
in place of the standard <txp:title />
.
See the help supplied with the plugin, or have a look online.
The idea behind adi_title is to provide some flexibility with article titles, by enabling different versions of the same title to be used. Some specific instances where I’ve used it are:
- with a series of titles “First one”, “Second one”, “Third one” etc, where I wanted an individual article title (e.g. “First one”) displayed in full but with a list of links using abbreviated titles (e.g. “First”, “Second” …) to the others
- with more meaningful titles visible in the Admin Article View (e.g. “Some topic – Some aspect”) but abbreviated on the webpage (e.g. “Some aspect”)
Examples
To give you an idea of what it does, here are some examples:
<txp:adi_title length="2" />
- output the first 2 words, e.g. “This title is a bit too long” becomes “This title …”
<txp:adi_title offset="-2" />
- output the last 2 words, e.g. “Not The End” becomes “The End …”
<txp:adi_title length="5" append="!" />
- output the first 5 words & append exclamation mark, e.g. “I bet you can’t guess what this says” becomes “I bet you can’t guess!”
<txp:adi_title offset="1" append="" separator="-" />
- use a hyphen as the separator & skip the first slice, e.g. “Good morning Smithers-Jones” becomes “Jones”
Version History
- 0.2
- TXP 4.6 tag registration
- new attributes: wraptag, class & html_id
- fix to ignore appended string if title not changed
- 0.1
- initial release
Requirements
Tested in Textpattern 4.0.6, but it’s so simple that it should work in other versions as well.
Download
Download adi_title and install the plugin in the normal way.
Credits
Thanks to ruud, fpradignac & Dragondz who replied to my initial query in this thread
If all you want to do is output the first few words of a title then you can use rss_auto_excerpt
as suggested by Dragondz. The following provide the same functionality:
<txp:adi_title length="1" append="" />
<txp:rss_auto_excerpt words="1" body="title" ending="" linktext="" />
Virtual Hugs
If you find this plugin useful and would like to spread the love, please consider donating to the Textpattern development team.
Last edited by gomedia (2015-08-05 02:05:07)
Offline
Re: adi_title - Abbreviated titles
Thanks, that looks like it could be useful for some situations and is a useful addition. Your second example highlights its dangers quite well…
TXP Builders – finely-crafted code, design and txp
Offline
#3 2009-01-04 23:21:34
- lous
- Member
- From: Germany
- Registered: 2009-01-04
- Posts: 57
Re: adi_title - Abbreviated titles
Hey,
at first, its a really nice plugin!
I have changed a bit this plugin, now i am able to give out just for example 5 letters instead of 5 words :)
My Question is now, if i can change also the “recent_articles” title. Cause currently its using the normal title but i want, that “recent articles” should use the adi_title.
And 2nd Question is. When i got a length of for example 56 LETTERS then i get 56 letters. BUT When the word got less than 56 letters, then i got everytime at the end of the word “…”.
How could i make it, that if the word got less than 56 letters, that i get no “…”???
Thank you soo much in advance and again, very nice plugin!
P.S.: Thats the new code
http://nevaforget.de/nopaste/index.php?id=956b98874d&view=nl
Last edited by lous (2009-01-04 23:37:59)
Offline
#4 2009-01-05 15:10:10
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: adi_title - Abbreviated titles
lous wrote:
at first, its a really nice plugin!
Thanks.
My Question is now, if i can change also the “recent_articles” title. Cause currently its using the normal title but i want, that “recent articles” should use the adi_title.
adi_title was designed to be used instead of the <txp:title />
– i.e. in article forms – so it won’t be of any assistance in conjunction with <txp:recent_articles />@. Sorry.
And 2nd Question is. When i got a length of for example 56 LETTERS then i get 56 letters. BUT When the word got less than 56 letters, then i got everytime at the end of the word “…”.
How could i make it, that if the word got less than 56 letters, that i get no “…”???
I’m not sure what’s significant about the number 56 but in the original adi_title plugin the attribute append=""
stops the “…” being output.
P.S.: Thats the new code
Thanks, I’m not really in the position to have a look at the moment but when I’m back in circulation later this month I will.
All the best.
Offline
#5 2015-08-05 02:06:16
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: adi_title - Abbreviated titles
Version 0.2 available for download:
- TXP 4.6 tag registration
- new attributes: wraptag, class & html_id
- fix to ignore appended string if title not changed
Offline
Pages: 1