Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#241 2013-03-24 16:52:25

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

merz1 wrote:

Can somebody of the admins please update the very first post to link to an available backup of the installer?

Done:)


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

Offline

#242 2013-04-04 19:16:57

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Is there an equivalent replacement for this plugin? I’m finding it stops rendering the page is RSS_auto_except encounters a <txp:image> tag in the paragraphs I’m asking for it to extract.

Does the same if I use <txp:title/> too which I tried as a test… seems to work if you have a closing tag though.

Last edited by douglgm (2013-04-04 19:18:05)

Offline

#243 2013-04-04 19:41:26

etc
Developer
Registered: 2010-11-11
Posts: 5,235
Website GitHub

Re: [plugin] [ORPHAN] rss_auto_excerpt

To extract the first paragraph, I use

<txp:if_excerpt>
	<txp:excerpt />
<txp:else />
	<txp:etc_query data='<txp:body />' query="p[1]" />
</txp:if_excerpt>

in the article form. It is absolutely indifferent to the presence of <txp:image /> or other tags. But the body must be well-structured.

Last edited by etc (2014-10-01 15:29:50)

Offline

#244 2013-04-04 20:09:09

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thanks Oleg, I’ll give that a try!

Offline

#245 2013-08-18 23:28:54

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

How would i show a few words of the latest News ( Section News) on my Home Page. which is default page. I have a News Section where in we have all the News articles and it uses a news Form and Page. The News Section is a the moment set to not show on home page.

Note i don’t make use of the Excerpt Feld … i only want to show first 10 words From the Body Latest News item/article.

is this correct?
<txp:rss_auto_excerpt length="10" linktext="Read more" ending="&hellip;" linkclass="readmore" body="body" />

and what tags do i use to show the News article and snippet on home page?


…. texted postive

Offline

#246 2013-08-19 00:58:06

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

Would something like this work?

<txp:article_custom
    section="news"
    limit="1">
    <txp:rss_auto_excerpt ... />
</txp:article_custom>

Offline

#247 2013-08-19 04:35:56

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

Thank-you!!! @johnstephens

I ended up using this as i only wanted a short output and to use my own link to the News Page (the default READ MORE link was’t working for me as it went to the permalink of the article and then the NEXT/PERVIOUS links were no longer working. I had similar issues if i used permalink option in my News Section.)

<p> <h3>NEWS</h3>
<txp:article_custom section="news" form="news_dynamic" limit="1">
<txp:rss_auto_excerpt length="60" body="body" overrideexcerpt="1" showlinkwithexcerpt="0" striptags="1" /> <a href="/news" /> READ >> 
</txp:article_custom>

Last edited by bici (2013-08-19 04:36:24)


…. texted postive

Offline

#248 2013-08-19 13:21:45

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

That sounds great, Bici!

I notice your article_custom tag is calling a form, but also being used as a container. I think that the container content always overrides the form argument, and you could get by without one or the other. If, for example, you put your rss_auto_excerpt and link in a form called “news_dynamic”, then you could eliminate the last two lines of code in the above pattern, and self-close the article_custom tag:

<txp:article_custom
    form="news_dynamic"
    limit="1"
    section="news"/>

If you only need to use this kind of excerpt in this one case, it might make more sense to use article_custom as a container tag, and you can eliminate the form attribute:

<txp:article_custom
    limit="1"
    section="news">
    <txp:rss_auto_excerpt
        length="60"
        body="body"
        overrideexcerpt="1"
        showlinkwithexcerpt="0"
        striptags="1"/>
    <a href='/news/'>
        READ &gt;&gt;
    </a>
</txp:article_custom>

There are some minor markup bugs that may cause some problems: It’s not semantic to nest a heading element in a paragraph, and if you do, you will get the styles for both. Also, your anchor element <a href="/news/"> is open, and the browser might render everything that follows as a link.

I hope this helps!

Last edited by johnstephens (2013-08-19 13:25:52)

Offline

#249 2013-08-19 17:58:55

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

thanks.! working fine without the call to the form which was a mistake on my part. not sure i understand this : It’s not semantic to nest a heading element in a paragraph

this is ok nchor element <a href="/news/"> is working as i wish. it simply takes the user to the news section and it displays Two Articles with the most recent one ( the one that was excepted) being at the top of the page


…. texted postive

Offline

#250 2013-08-19 18:28:05

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

bici wrote:

thanks.! working fine without the call to the form which was a mistake on my part. not sure i understand this : It’s not semantic to nest a heading element in a paragraph

You can see for yourself if you put this code into the HTML validator :

<body>
<p><h3>News</h3>
[Excerpt] Read >></p>
</body>

Here’s the output:

Error: No p element in scope but a p end tag seen.

The reason is that “p” means “paragraph” and “h3” means “heading”. A paragraph cannot contain a heading. When the HTML parser sees a h3 element inside a paragraph, it immediately closes the paragraph and opens a heading. It basically treats the above markup like this:

<body>
<p></p> <!-- Empty paragraph -->
<h3>News</h3>
[Excerpt] Read >>
</p> <!-- end tag without matching start tag -->

this is ok anchor element <a href="/news/"> is working as i wish. it simply takes the user to the news section and it displays Two Articles with the most recent one ( the one that was excepted) being at the top of the page

I understand that. The way you pasted it in the form, the anchor element has no end tag, and that can cause problems later in your page:

[…] <a href="/news" /> READ >> 
</txp:article_custom>

Without the end tag </a>, the HTML parser will turn everything else after that in your page into a link, until it sees another </a>

You can see it in the HTML validator, by pasting this code in:

<body>
<h3>News</h3>
[Excerpt] <a href="/news" /> READ >>

<div>
<p>This is more text.

<p>This is more text.

<p>Here is another <a href="http://google.com/">Another Link</a>
</div>
</body>

That’s why I had a start and end tag in the code I posted above:

<a href='/news/'>READ &gt;&gt;</a>

This should do what you want without any HTML problems:

<h3>NEWS</h3>
<txp:article_custom
    limit="1"
    section="news">
    <txp:rss_auto_excerpt
        length="60"
        body="body"
        overrideexcerpt="1"
        showlinkwithexcerpt="0"
        striptags="1"/>
    <a href='/news/'>
        READ &gt;&gt;
    </a>
</txp:article_custom>

Offline

#251 2013-08-19 19:47:30

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

Re: [plugin] [ORPHAN] rss_auto_excerpt

Yes thanks… i hadn’t noticed that opening <p> tag!


…. texted postive

Offline

#252 2014-06-01 07:12:39

peterj
Member
From: Melbourne, Australia
Registered: 2005-06-02
Posts: 99

Re: [plugin] [ORPHAN] rss_auto_excerpt

Quick fix to stop the “keep reading” link generating when showlinkwithbody=“0” and when RSS_auto_excerpt is as long as the body.

If using paragraphs, change line 45 to.

$pghcount = count(explode("</p>", $body))-1;

The paragraph count returns one more than there actually are so rather than work out why.. I’ve just subtracted one. Similar may work for sentances.

Offline

Board footer

Powered by FluxBB