Textpattern Forum

You are not logged in. Register | Login | Help

#21 2006-10-27 01:54:30

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Feature request: Ignore content of certain HTML tags like img tags or linked images

Very often I have one or more linked Images at the beginning of my articles. I would like the plugin to ignore these links and image tags when creating an excerpt.

A pure text excerpt would be very welcome …


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#22 2006-10-27 13:23:48

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

rss_auto_excerpt 0.2

Many new features including the following:

  • striptags attribute to remove all HTML tags from the auto excerpt
  • overrideexcerpt attribute to display auto excerpt even if one already exists for the article
  • showlinkwithexcerpt attribute to allow you to turn off the automatic link when an auto excerpt is displayed
  • skiplength, skipwords and skipparagraphs attributes to create “reverse” excerpts which display the article body except for the first x characters, words or paragraphs.

More details and an example of a “reverse” excerpt can be found in the plugin help.

rss_auto_excerpt 0.2

Download

Offline

#23 2006-10-27 14:33:07

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thanks!!!! This allows me to use the excerpt as the title attribute of my permalinks!!!!

Offline

#24 2006-10-27 15:30:39

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

@Rob: Great work!!!

Minor issue: Using striptags is not possible with paragraphs as no paragraphs are left after striptags. The whole article is shown.

Tag tweaking / Minor hack: If somebody wants to keep certain tags it is possible to add them to the plugin code

Strip all tags: $body = ($striptags) ? strip_tags($body) : $body;
Keep h4 tags: $body = ($striptags) ? strip_tags($body, '<h4>') : $body;

Pls. see PHP documentation for more info.

My code example for the homepage on my website:

<txp:rss_auto_excerpt length="260" linktext="Mehr ..." overrideexcerpt="1" striptags="1" linkwraptag="strong" />

Combined with the tag tweaking from above I get my leading h4 sub-headline plus two lines of text from the first paragraph.

Rob: Beautiful result. Thanks!!!

Last edited by merz1 (2006-10-30 15:30:05)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#25 2006-10-27 15:43:14

Prax
Member
From: Huntsville, AL
Registered: 2006-09-27
Posts: 24

Re: [plugin] [ORPHAN] rss_auto_excerpt

Woo! Thanks for the new features Rob!

Offline

#26 2006-10-30 00:56:45

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

I think I found a small bug, but I’m not fur shur. It seems that when there is a mix of articles, some with and some without user created excerpts there is a conflict.

Here is a snip from the article form in question.

<div class=“ex”>
<txp:article_image thumbnail=“1” />
<!—excerpt code—>
<h4><txp:title /></h4><txp:rss_auto_excerpt linktext=“Read more” linkclass=“read-all” length=“180” overrideexcerpt=“1” striptags=“1” />

OK so this is the problem. On preexisting articles in the db that already have an excerpt this works a charm. For any new articles that have a blank excerpt the article thumbnail does not show and the plugin generated “read more” link does not show. If however I type in even just one character into the excerpt box for those new articles all works well, and as expected.

Also, if the article text count does not meet or exceed the length attribute used, the plugin does not work and generates a borked excerpt.

Last edited by soulship (2006-10-30 00:58:08)

Offline

#27 2006-10-30 14:16:36

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

@soulship: I can’t confirm the error. I have articles with and without excerpts and rss_auto_excerpt works fine. As posted above my rss_auto_excerpt tag is:

<txp:rss_auto_excerpt length="260" linktext="Mehr &hellip;" ending="&hellip;" 
overrideexcerpt="1" striptags="1" linkwraptag="strong" />

As you see I am also using length=, overrideexcerpt=“1” and striptags=“1”.

You may check my site. Article “St. Georg, Hamburg: Internet Kamera von Philips” (25.10.06) has no excerpt and most of the others have. You can se if an article has an excerpt or not by viewing the category view. Articles with an excerpt have a huge ‘weiter lesen:’ link and icon.

Are you using (wrapping) if-excerpt conditions somewhere in this context?

Last edited by merz1 (2006-10-30 14:17:02)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#28 2006-10-30 20:40:45

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

I am using if_excerpt. To wrap the tag as a matter of fact…. Well here’s my form.

<txp:if_excerpt>
<div class="ex">
<txp:hak_article_thumb limit="1" link="1" linktype="image" popup="0" rel="lightbox" />
<!-- excerpt code-->
<h4><txp:title /></h4><txp:rss_auto_excerpt linktext="Read more" linkclass="read-all" length="180" overrideexcerpt="1" striptags="1" />
<!--<span class="readme"><txp:permlink>read more...</txp:permlink></span>-->

<div class="divider"></div><!--end class divider-->
</div><!--end div ex-->
<txp:else />.....

[EDIT: to shorten post and fix lazy code pasting :) ]

Last edited by soulship (2006-10-31 11:59:40)

Offline

#29 2006-10-31 02:25:08

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Shortened for better understanding.

<txp:if_excerpt>
<txp:rss_auto_excerpt />
<txp:else />.....

But you know that the code between txp:if_excerpt and txp:else will only be executed when there is an excerpt?

That exactly was the reason why I was asking. If you put all the code after the txp:else only then it will work if there is no excerpt.

<txp:if_excerpt>
Code for the 'if there is an excerpt' goes here. 
    i.e. <txp:excerpt> will print the existing excerpt
    or <txp:rss_auto_excerpt overrideexcerpt="1"/> will create excerpt from body.

If there is NO excerpt this part will NEVER be executed!

<txp:else />

Code for the 'if there is NO excerpt' goes here. 
    That's your 'empty' case!
    i.e. <txp:rss_auto_excerpt /> will create excerpt from body.
<txp:if_excerpt />

txp:rss_auto_excerpt per default makes the decision by itself. That’s what the overrideexcerpt=“0” or “1” is for. 1 will NOT use the excerpt, 0 will use the excerpt if there is one.

Your code would be:

<div class="ex">
<txp:hak_article_thumb limit="1" link="1" linktype="image" popup="0" rel="lightbox" />
<!— excerpt code—>
<h4><txp:title /></h4><txp:rss_auto_excerpt linkclass="read-all" length="180" overrideexcerpt="1" striptags="1" linkclass="read-all" length="180" linktext="read more…" />
<div class="divider"></div><!—end class divider—>
</div><!—end div ex—>

If you want “read more…” in an extra paragraph you need to add linkwraptag=“p”.

If you want you can wrap a permlink around txp:title as people are used to click on titles but that’s pure cosmetic regarding our problem.

BTW: Code in bigger blocks is Textile coded bc.. (double dot) followed by a p. (one dot) after the quote. Why am I telling this? Because I had to correct all quotes from your code when pasting it :-)

Last edited by merz1 (2006-10-31 02:54:49)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#30 2006-10-31 11:53:58

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

merz1 wrote:

But you know that the code between txp:if_excerpt and txp:else will only be executed when there is an excerpt?

:-) !!!! DUH !!! Yes I do so I’m not sure why I was overlooking that. Staring at it too long I guess. So thanks for the wake-up spash of water. I have been working on this site redo for about 8 days straight so I must be getting burnt out.

So now I just have:

<txp:if_article_list>
<div class="ex">
<txp:hak_article_thumb limit="1" link="1" linktype="image" popup="0" rel="lightbox" />
<!— excerpt code—>
<h4><txp:title /></h4><txp:rss_auto_excerpt linkclass="read-all" length="180" overrideexcerpt="1" striptags="1" linkclass="read-all" length="180" linktext="read more…" />
<div class="divider"></div><!—end class divider—>
</div><!—end div ex—>
<txp:else>

And all is right with the world finally :)

merz1 wrote:

If you want you can wrap a permlink around txp:title as people are used to click on titles but that’s pure cosmetic regarding our problem.

I already took care of that, but it’s higher up in that article form so I didn’t bother pasting it..

<h2 class="posttitle">
<txp:asy_wondertag>
<txp:permlink class="perm" title="
<txp:rss_auto_excerpt length="150" linktext="" linkwraptag="" showlinkwithexcerpt="0" overrideexcerpt="1" striptags="1" />"><txp:title /></txp:permlink>
</txp:asy_wondertag>
</h2>

So thanks so much for waking me up and pointing me in the right direction for my silly overlooking of a basic!

Last edited by soulship (2006-10-31 12:18:51)

Offline

Board footer

Powered by FluxBB