Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#145 2008-12-22 15:09:47

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Hi Papuass,

I ran into the same problem and did a bit of sleuthing… The issue may be connected to the strip-tags() function, however I think the problem lies more in tinkering with how textile is interpreting article contents.

If you use textile (or not) check to see if your article contents is poorly formed HTML – for example, if you have a carriage return (empty line) before your image tag, it is possible that the code itself looks like:

<p><img src="http://someimage.com/" /></p>

This causes the page to choke when rendering auto-excerpt. I was having the problem with DHTML Divs as well – nesting block level containers within in-line containers seems to be a no-no…

Remove the <p> tags from around your image and see if that solves the problem for you. It did for me.

UPDATE: I have to retract my statement… this plug-in has problems rendering anything with nested tags – legit or not.

In the case of textile autoformatting: this code causes a page halt:

<p><img src="http://some image/" /></p>

This can be resolved by throwing notextile. in front of the offending txp image tag… BUT -

<object etc><embed etc><param etc></param></embed></object>

also breaks the auto-excerpt and these nested tags seem unavoidable. So embedding any sort of flash/youtube content is not plausible. :-( Unless you put it lower in the page than autoexcerpt will go… like paragraph 3.

Last edited by jagorny (2008-12-23 01:27:22)

Offline

#146 2009-01-11 23:42:19

jhwilliams
Member
Registered: 2007-01-04
Posts: 13

Re: [plugin] [ORPHAN] rss_auto_excerpt

Hello -

I’ve never used a plugin before and I just can’t figure out how to use this. I tried to follow the instructions already posted on the forum and here is what is happening.

For my default page, I did this:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<head> <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /> <title><txp:page_title /></title>

<link rel=“home” href=”<txp:site_url />” />

<txp:feed_link flavor=“atom” format=“link” label=“Atom” /> <txp:feed_link flavor=“rss” format=“link” label=“RSS” />

<txp:css format=“link” />
</head>
<body id=”<txp:if_section name=“default”>front<txp:else /><txp:section /></txp:if_section>”>

<!— accessibility —>
<div id=“accessibility”> <ul> <li><a href=”#content”><txp:text item=“go_content” /></a></li> <li><a href=”#sidebar-1”><txp:text item=“go_nav” /></a></li> <li><a href=”#sidebar-2”><txp:text item=“go_search” /></a></li> </ul>
</div>

<div id=“container”>

<!— head —> <div id=“head”> <center><txp:image id=“6” /></center></txp:link_to_home></h1>

</div>

<!— left —> <div id=“sidebar-1”>

<txp:section_list wraptag=“ul” break=“li” />

<txp:search_input wraptag=“p” />

<p><txp:feed_link label=“RSS” /> / <txp:feed_link flavor=“atom” label=“Atom” /></p> </div>

<!— right —> <div id=“sidebar-2”>

<img src=“http://speakingpictures.net/images/4.jpg”>

<txp:linklist wraptag=“p” />

<p><a href=“http://textpattern.com/”><img src=”<txp:site_url />textpattern/txp_img/txp_slug105x45.gif” width=“105” height=“45” alt=“Textpattern” title=”“ /></a></p> </div>

<!— center —> <div id=“content”>
<txp:if_category> <h2><txp:category title=“1” /></h2>

<div class=“hfeed”>

<txp:article limit=“7” searchsticky=“1” listform=“excerpt” />

</div>
<txp:else /> <txp:if_search> <h2><txp:text item=“search_results” />: <txp:page_url type=“q” /></h2>

<div class=“divider”><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” alt=”—-” title=”“ /></div> </txp:if_search>

<div class=“hfeed”> <txp:article limit=“5” /> </div>
</txp:if_category>
<txp:if_individual_article> <div class=“divider”><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” alt=”—-” title=”“ /></div>

<p><txp:link_to_prev>&#171; <txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /> &#187;</txp:link_to_next></p>
<txp:else /> <p><txp:older>&#171; <txp:text item=“older” /></txp:older> <txp:newer><txp:text item=“newer” /> &#187;</txp:newer></p>
</txp:if_individual_article>

</div>

<!— footer —> <div id=“foot”>&nbsp;</div>

</div>

</body>
</html>

I made a form called “excerpt”:
<code>
<div class=“excerpt”>
<h3><txp:permlink><txp:title /></txp:permlink></h3>

<txp:if_excerpt>
<txp:excerpt />
<txp:else />
<txp:rss_auto_excerpt length=“500” showlinkwithexcerpt=“0” />
</txp:if_excerpt>

</div><!—/excerpt—></code>

But when I go to my site, I get this error message at the top of the page:

Parse error: syntax error, unexpected T_STRING in /home/locustwi/public_html/speakingpictures/textpattern/lib/txplib_misc.php(574) : eval()’d code on line 1
The above errors were caused by the plugin:rss_auto_excerpt

What do I need to fix to have the plugin work properly?

Thanks very much,

Jennifer

Offline

#147 2009-01-21 02:12:46

dl33
Member
Registered: 2006-06-17
Posts: 192
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Any way to get the plugin to output a certain number of paragraphs, which include both the excerpt and the body? So if there are two paragraphs in the excerpt + nine in the body and I am limiting the output to three paragraphs, it would grab the two from the excerpt and the remaining one from the body.

Offline

#148 2009-03-09 05:13:06

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

hmmm i’m getting some errors that don’t seem right;

<txp:rss_auto_excerpt linkclass="morelink" wrapreadmore=“1”  /> 

produces:

Tag error:  <txp:rss_auto_excerpt linkclass="morelink"  	wrapreadmore=“1” /> ->  Textpattern Warning: Attribute values must be quoted  on line 916
Tag error:  <txp:rss_auto_excerpt linkclass="morelink"  	wrapreadmore=“1” /> ->  Textpattern Warning: Attribute values must be quoted  on line 916
Tag error:  <txp:rss_auto_excerpt linkclass="morelink"  	wrapreadmore=“1” /> ->  Textpattern Warning: Attribute values must be quoted  on line 916

there are three articles so that’s why it repeated three times. if i remove wrapreadmore it disappears. had this with some other tag attributes as well.

Offline

#149 2009-03-09 12:14:54

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

If what you’ve pasted here is exactly what you have in your template, it looks like the quotes on wrapreadmore are curly. Try this:

<txp:rss_auto_excerpt linkclass="morelink" wrapreadmore="1"  />

Offline

#150 2009-03-10 23:22:59

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

johnstephens wrote:

If what you’ve pasted here is exactly what you have in your template, it looks like the quotes on wrapreadmore are curly. Try this:

<txp:rss_auto_excerpt linkclass="morelink" wrapreadmore="1"  />

ok thanks. i think the problem was i was copying and pasting off the help file, but i don’t understand what character that is then(curly)? well it’s fixed, and now i know better than to copy and paste next time ;)

Last edited by mrtunes (2009-03-10 23:23:20)

Offline

#151 2009-03-10 23:28:08

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

I’m glad that worked!

Textile converts straight quotes like this " to curly quotes like this “ —which is good for typesetting, bad for code samples.

Offline

#152 2009-04-06 01:27:25

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

I had to use this ‘hack’ to get the skipparagraphs attribute to work. Can anyone confirm that this attribute works at all without the hack? This attribute is even used as an example in the plugin help docs. Maybe this is a problem that arose with some Txp core update.

I find it very convenient to use the first paragraph of an article as excerpt. It leaves a nice juicy excerpt field open in all my articles for something more creative.

But some articles start with pictures, movies, headings, etc., so I end up just copying the first real paragraph up at the very beginning of every article. Then I just need to skip it when displaying the whole article, so I’m replacing <txp:body /> with:

<txp:rss_auto_excerpt skipparagraphs="1" paragraphs="9999" showlinkwithexcerpt="0" overrideexcerpt="1" />

As this hack is introducing some minor tag trace errors in my individual article pages, does anyone know of a more elegant way to skip the first paragraph? I tried wrapping the first paragraph with <txp:if_article_list> but it doesn’t work for some reason; it still displays on individual articles. Doing the inverse with <txp:if_individual_article> didn’t work perfectly either; I forget exactly what the behavior was but something wasn’t showing up where it should have.

EDIT: I guess using a custom field to store the first paragraph in articles that don’t actually start with the paragraph would actually be more convenient than doing the extra work of copying every first paragraph to the beginning of every article.

Last edited by aswihart (2009-04-06 23:26:34)

Offline

#153 2009-05-22 08:48:32

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Eureka… A solution to my issue with this plug-in…

function strip_tags_attributes($string,$allowtags=NULL,$allowattributes=NULL){ 
    if($allowattributes){ 
        if(!is_array($allowattributes)) 
            $allowattributes = explode(",",$allowattributes); 
        if(is_array($allowattributes)) 
            $allowattributes = implode("|",$allowattributes); 
        $rep = '/([^>]*) ('.$allowattributes.')(=)(\'.*\'|".*")/i'; 
        $string = preg_replace($rep, '$1 $2_-_-$4', $string); 
    } 
    if(preg_match('/([^>]*) (.*)(=\'.*\'|=".*")(.*)/i',$string) > 0){ 
        $string = preg_replace('/([^>]*) (.*)(=\'.*\'|=".*")(.*)/i', '$1$4', $string); 
    } 
    $rep = '/([^>]*) ('.$allowattributes.')(_-_-)(\'.*\'|".*")/i'; 
    if($allowattributes) 
        $string = preg_replace($rep, '$1 $2=$4', $string); 
    return strip_tags($string,$allowtags); 
}

Insert this code at the end of the plug-in, and then use it as a replacement for the strip_tags function around line 39:

		$body = ($striptags) ? strip_tags($body,"img") : $body;

Change the strip_tags call in the code above to strip_tags_attributes and nested tags will not break the plug-in as often… I have yet to try it with an article that has a flash video embedded. I will try that next.

Offline

#154 2009-05-29 00:43:12

dl33
Member
Registered: 2006-06-17
Posts: 192
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Is there an attribute in order to not show the Read more link… (I need to place one somewhere else and right now I have two.)

Offline

#155 2009-05-29 01:23:44

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

@dl33 Is this what you need?

showlinkwithexcerpt="0"

from the plugin help file:

showlinkwithexcerpt: Determines whether the permlink to the article will be shown when the automatic excerpt is displayed.

Last edited by johnstephens (2009-05-29 01:24:41)

Offline

#156 2009-05-30 00:04:56

dl33
Member
Registered: 2006-06-17
Posts: 192
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

@johnstephens: Thanks, that worked.

Offline

Board footer

Powered by FluxBB