Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] sab_substr
Yeah I know about this. But the problem is it wont display in IE. My audiences primarily use IE.
“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”
— Albert Einstein
Offline
#17 2007-07-27 13:49:06
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: [archived] sab_substr
Hello all,
I am into this same problem where I want to trim the Title (<txp:title />) length and put (…) at the end. It seems that this plugin can do the jo, but I really dion’;t where to get this plugin.
The site www.bluecamel.org is not working.
Can I anyone suggest me where to get this plugin or any other way how to accomplish it ?
Thanks.
Offline
Re: [archived] sab_substr
An attempt to recreate the plugin code (requires TXP 4.0.4 or higher).
Tag usage is identical to the one described at the beginning of this topic. This one should behave UTF8-aware and assumes the enclosed content has not yet been HTML escaped(default limit = 10, default trailing char is the ellipsis character).
Last edited by ruud (2007-07-29 13:57:12)
Offline
#19 2007-07-29 14:47:57
- fas.khan
- Member
- From: Paris
- Registered: 2007-06-06
- Posts: 41
Re: [archived] sab_substr
Whoa …
Now this is the way Dutch Bell the Cats … :-)
Done ! …
Thank you so so much …
Offline
Re: [archived] sab_substr
Hi Ruud, thank you very much for updating this plugin!
I am having a little trouble with unencoded html entities, a lot of ’ and –.
I also modified the plugin slightly to include $thing = strip_tags($thing); to remove html tags as I am using it to output txp:body content.
Any help with the html codes would be great!
Last edited by Sam (2007-08-09 22:34:19)
Sam Brown
sambrown.me | welovetxp.com
Offline
#21 2007-09-01 12:48:39
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
Re: [archived] sab_substr
hi…
i’m feeling a bit stumped here, like as if there’s something obvious i’m missing…
as a result of my previous thread about title shortening, i was redirected to this thread, and i’ve now installed and activated this plugin, but it’s not working at all. the sab_substr code is simply being spat straight through to the final html on the page, so that i end up with page code like this:
<h4><sab_substr limit=“10” trail=”…”>Here’s a long title</sab_substr></h4>
however, other plugins are working fine running alongside it… is there something i’ve overlooked?
thanks…
snthr.
Offline
Re: [archived] sab_substr
Use <txp:sab_substr> instead of <sab_substr> :)
Offline
#23 2007-09-01 16:40:07
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
Re: [archived] sab_substr
Offline
#24 2007-09-01 18:22:23
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
Re: [archived] sab_substr
so i got it up and running (sheepish face), but i seem to be getting the same problems as sam posted about (quoted below), with ‘& #160’ and the like coming through – any ideas for a fix?
thanks…
Sam wrote:
Hi Ruud, thank you very much for updating this plugin!
I am having a little trouble with unencoded html entities, a lot of & #8217; and & #8211;.
I also modified the plugin slightly to include
$thing = strip_tags($thing);to remove html tags as I am using it to output txp:body content.Any help with the html codes would be great!
Offline
Re: [archived] sab_substr
The ‘& #160’ problem can probably be solved by disabling the ‘nowidow’ option in the TXP preferences.
Offline
Re: [archived] sab_substr
Hope I’m not treading on your toes here Ruud, but I needed a chop-tag-text plugin so I could output parts of the description field from zem_event, among others. None of the excerpt type plugins worked on non-txp tables :-(
Being a container tag, this was the closest I found that could do the job so I took it and made a slightly updated version, I hope fully backwards compatible with your rewrite.
Adds a few features like striptags, the ability to skip characters if you like, output chars from just the start or end of the string, and also the ability to split the output into two bits, each styled and classed separately (if required) to perhaps apply dropcap-type functionality. *shrug* I needed it and can’t rely on CSS2’s :first-letter in IE6.
The only thing I couldn’t figure was why the regex wouldn’t work on large fields like the output of the <txp:body /> tag; just refused to limit the output. Weird. But since you run everything through utf8_decode() first, I figured it was probably safe to just use substr. I’m not great with this encoding entities lark, so let me know if I’ve screwed up.
EDIT: a small problem is that potentially the “excerpt” (for want of a better word) might cut-off in the middle of an entity and leave a strange half-entity on the page, which may cause problems. Probably a way round it one day…
EDIT2: My version of the plugin removed. Ruud’s version is official, mine isn’t, so I’ll keep it to myself.
Last edited by Bloke (2008-01-05 23:22:30)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: [archived] sab_substr
Arg! I’ve been toying with this all day and – alas – this wonderful little plug-in doesn’t seem to work. At least it doesn’t seem to work on <txp:body /> or <txp:excerpt />. I can only get it to work with <txp:title />. Is this so or am I just doing something wrong?
My code:
<h1><txp:permlink><txp:sab_substr limit="25" trail=""><txp:title /></txp:sab_substr></txp:permlink></h1>
<txp:sab_substr limit="230" trail="..."><txp:excerpt /></txp:sab_substr>
Offline
Re: [archived] sab_substr
How does it not work?
Offline
Re: [archived] sab_substr
It’s not limiting the <txp:excerpt /> output. I’m getting the complete <txp:excerpt /> without any limits. (which I just realized is a redundant sentence)
Last edited by bullseyeinteractive (2008-03-11 20:43:59)
Offline
Re: [archived] sab_substr
bullseyeinteractive wrote:
It’s not limiting the
<txp:excerpt />output.
fwiw (for ruud), I think it’s something to do with the regular expression. For some reason it fails the match against anything other than a simple short tag like txp:title. I couldn’t fathom it, because it looks like it should work. Mind you, I’m pretty rubbish with regex, so I cheated and used substr() instead when I hacked it.
Last edited by Bloke (2008-03-11 20:50:13)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline