Page 1 of 1

[Solved] RSS2HTML - shorter summary how?

Posted: Tue Nov 18, 2008 9:00 pm
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.

Re: RSS2HTML - shorter summary how?

Posted: Tue Nov 18, 2008 9:15 pm
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

Re: RSS2HTML - shorter summary how?

Posted: Tue Nov 18, 2008 10:30 pm
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!

Re: RSS2HTML - shorter summary how?

Posted: Wed Nov 19, 2008 8:07 am
by nhaack
nice! Each day I realize... you can do more and more with smarty...

Re: RSS2HTML - shorter summary how?

Posted: Thu Nov 20, 2008 10:14 am
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)

Re: RSS2HTML - shorter summary how?

Posted: Fri Nov 21, 2008 6:47 am
by ravonet
nhaack & Zoorlat: thank you so much - it works perfect  :)

Re: [Solved] RSS2HTML - shorter summary how?

Posted: Tue Nov 25, 2008 2:58 pm
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:






Re: RSS2HTML - shorter summary how?

Posted: Tue Jun 21, 2011 4:26 am
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)