[Solved] RSS2HTML - shorter summary how?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
ravonet
Forum Members
Forum Members
Posts: 59
Joined: Fri Jan 11, 2008 12:04 pm

[Solved] RSS2HTML - shorter summary how?

Post by ravonet »

Is it possible to make the RSS2HTML summary shorter than default? Lets say 120 characters.

My template looks like this:
{foreach from=$rss->items item=item}


{$item.title}
{$item.summary}

{/foreach}
Thanks.
Last edited by ravonet on Fri Nov 21, 2008 6:47 am, edited 1 time in total.
nhaack

Re: RSS2HTML - shorter summary how?

Post by nhaack »

You could try the truncate modifier in smarty... so it would look something like the following:

{$item.summary|truncate:120}

However, if there are HTML Tags included, you might break the validity here... but if it is just regular content, you should be all fine...

Best
Nils
Zoorlat

Re: RSS2HTML - shorter summary how?

Post by Zoorlat »

Just a quick follow up on Nils' post. 
If there are HTML tags you could also remove those first using the strip_tags modifier.

To do that, just try something like:   
{capture name=summary}
       {$item.summary|strip_tags}
{/capture}

And then you can truncate this new summary string. ;)
eg: {$summary|truncate:120}

Cheers!
nhaack

Re: RSS2HTML - shorter summary how?

Post by nhaack »

nice! Each day I realize... you can do more and more with smarty...
Zoorlat

Re: RSS2HTML - shorter summary how?

Post by Zoorlat »

... actually, that capture-part in my previous example is not necessary.   :-\

You can add all the modifiers at once.
Eg:
{$entry->content|strip_tags|summarize:10}
gives a tag stripped, 10 word summary of the News content.

More useful smarty tips can be found on CMSMS-guru Calguy's homepage (calguy1000.com)
ravonet
Forum Members
Forum Members
Posts: 59
Joined: Fri Jan 11, 2008 12:04 pm

Re: RSS2HTML - shorter summary how?

Post by ravonet »

nhaack & Zoorlat: thank you so much - it works perfect  :)
ml55

Re: [Solved] RSS2HTML - shorter summary how?

Post by ml55 »

I am trying to get rid of unwanted - Â - characters and bold words ie [, ] from item descriptions when using rss2html.php.

http://tinyurl.com/5tvgl5

It was suggested that I use the following code but does anyone know where to put this in the rss2html.php file?

any help greatly appreciated.






























To us it, try this:





albleebluetooth
New Member
New Member
Posts: 3
Joined: Tue Jun 21, 2011 4:18 am

Re: RSS2HTML - shorter summary how?

Post by albleebluetooth »

Thank you, @Zorlat, for the info. I am a newbie and seem lost...

May I know in which specific file of the package I can find this line
{$entry->content|strip_tags|summarize:10}
in order to revise the summary size to, say, only 34 words (the default of some 50 words is too long summary for me)?

Thanks x 2.
Zoorlat wrote:... actually, that capture-part in my previous example is not necessary.   :-\

You can add all the modifiers at once.
Eg:
{$entry->content|strip_tags|summarize:10}
gives a tag stripped, 10 word summary of the News content.

More useful smarty tips can be found on CMSMS-guru Calguy's homepage (calguy1000.com)
Post Reply

Return to “Modules/Add-Ons”