Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-16 18:26:46

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

fly_excerpt - Truncate Article Excerpt

This little Helper-Plugin can truncate the words from an Article Excerpt.

<txp:fly_excerpt />

The Plugin accepts 4 Parameters
  • truncate – How many words should the Excerpt have – Default: 10
  • more – String to show User there is more content. Default:
  • link – Show “more” String as HTML Link. Values 0(no) or 1(yes). Default: 0
  • class – Optional HTML Class Name for “more” String Link

Changelog

Version 1.02 (28. Sept. 2016)

  • Added register for fly_excerpt Tag `->register(‘fly_excerpt’)` for compatibility to Textpattern Ver. 4.6.0

Version 1.01 (16. Feb. 2015)

  • Bugfix for Excerpt with HTML Code

Version 1.0 (16. Feb. 2015)

  • Initial Release

Last edited by superfly (2016-09-28 09:04:22)


<code>is</poetry>

Offline

#2 2015-02-16 18:42:29

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: fly_excerpt - Truncate Article Excerpt

Suppose you have an article like this:

There is <b>bold text</b> in this line.

If you set truncate to 3, then your plugin creates the following excerpt:

There is <b>bold

But it should be:

There is <b>bold</b>

Offline

#3 2015-02-16 19:08:05

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

Re: fly_excerpt - Truncate Article Excerpt

In reply to ruud #288308:

Hey ruud,
Thanks for the feedback! I made a quick Hotfix, until I can come up with a better solution, I striped the HTML Code from the Excerpt.


<code>is</poetry>

Offline

#4 2015-04-19 11:15:58

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: fly_excerpt - Truncate Article Excerpt

thank you for this one!
Maybe you should mention, that one has to wrap the excerpt with tags.
<p><txp:fly_excerpt truncate="50" /></p>

At least <txp:excerpt /> returns the text already inside <p> tags.

Last edited by whocarez (2015-04-21 20:47:20)

Offline

#5 2015-04-19 23:46:27

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,094
Website Mastodon

Re: fly_excerpt - Truncate Article Excerpt

cool plugin. one of the reasons that i don’t use the excerpt very much was that one could not truncate the output.

I think one for <body> would also be cool. i.e.

<p><txp:fly_body_excerpt  truncate="50" /></p>

ps can one wrap the tag in If / Else for those times when there is no <excerpt> ?

Last edited by bici (2015-04-19 23:46:47)


…. texted postive

Offline

#6 2015-04-20 08:20:03

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: fly_excerpt - Truncate Article Excerpt

Wow: only 19 posts and two three1 plugins as a present to the community!

Nice site, too, BTW.

1 : Apart the previous fly_cat_restriction and the brand new fly_excerpt I discovered also this: Amazon & LastFM plugin (with the old – not standard – fw prefix). I’m asking if are there others…

Last edited by candyman (2015-04-20 08:47:45)

Offline

#7 2015-04-20 09:45:06

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: fly_excerpt - Truncate Article Excerpt

bici wrote #290128:

ps can one wrap the tag in If / Else for those times when there is no <excerpt> ?

there is a native tag for that.

<txp:if_excerpt>
<p><txp:fly_excerpt truncate="50" /></p>
<txp:else />
</txp:if_excerpt>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2015-04-20 15:03:13

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,094
Website Mastodon

Re: fly_excerpt - Truncate Article Excerpt

candyman wrote #290131:

Wow: only 19 posts and two three^1^ plugins as a present to the community!

Nice site, too, BTW.

indeed Super Site by Super Fly!


…. texted postive

Offline

#9 2016-09-27 16:22:03

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

Re: fly_excerpt - Truncate Article Excerpt

Nice site, too, BTW.

indeed Super Site by Super Fly!

Jeez, I should read the Forums more often. candyman, bici thanks a lot for the probs!

Last edited by superfly (2016-09-27 22:18:57)


<code>is</poetry>

Offline

#10 2016-09-27 19:47:15

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: fly_excerpt - Truncate Article Excerpt

Welcome back! Have you read the news? Hope your plugins are ready.

Last edited by candyman (2016-09-27 19:47:36)

Offline

#11 2016-09-28 09:12:59

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 24
Website

Re: fly_excerpt - Truncate Article Excerpt

candyman wrote #301796:

Welcome back! Have you read the news? Hope your plugins are ready.

Thanks! Yep, I read the good news, this was the reason I was here. Me had some troubles wit locales and I need to update my plugins.


<code>is</poetry>

Offline

Board footer

Powered by FluxBB