RSS Block

Permalink 3 users found helpful
I have install the RSS block, and it is reading my RSS feed correctly. However, it cuts off the full content of long RSS entries. Is there a way to make some kind of a "Read More" link to click on so that users can link over to my RSS page? Thanks.

bballhermit
 
osu replied on at Permalink Reply
osu
Could try this: copy the rss_displayer block folder from:

/concrete/blocks/rss_displayer

to:

/blocks/rss_displayer

and change this:

<div class="rssItemSummary">
<?php  if( $rssObj->showSummary ){
echo $textHelper->shortText(strip_tags($item->get_description()) );
}
?>
</div>


to this:

<div class="rssItemSummary">
<?php  if( $rssObj->showSummary ){
echo $textHelper->shortText(strip_tags($item->get_description()) );
}
?>
<a href="#url_to_your_rss_feed">Read more...</a>
</div>


Obviously you need to put in the url of your feed above. If you don't have one, take a look at this page where Franz suggests how to add one:

http://www.concrete5.org/community/forums/customizing_c5/how_to_cre...

Hope that helps
bballhermit replied on at Permalink Reply
bballhermit
Hmm, I think that is along the right track of what I want, however, I do not want a "Read More..." that links to the RSS feed itself, but rather the original hyperlink that was passed from my feed which the RSS displayer block converted to simply "[Link]".


For example, if an RSS post had a summary including something like this:

"...check outhttp://www.concrete5.org for an excellent CMS solution..."

The RSS displayer block displays the following:

"...check out [Link] for an excellent CMS solution..."


I want the original hyperlink to carry over so viewers of my site can click the link in the RSS block to jump over to that link's source. Thank you.
bballhermit replied on at Permalink Reply
bballhermit
Oh, and I'd ideally like to use something similar to the HTML <a href ...> tag so I could have the RSS Displayer display something like the following:

"...check out <a href = "www.concrete5.org">Concrete5</a> for an excellent CMS solution..."

Is that possible? Note, my RSS feed also is distributed via an emailing list, so I want links to display correctly to my recipients there, too. Thanks.
osu replied on at Permalink Reply
osu
Hi,

I believe this is the code to edit (same file to edit - blocks/rss_displayer/view.php) as the description is being filtered with PHP to make it just text i.e. it's stripping the tags:

<div class="rssItemSummary">
<?php 
if( $rssObj->showSummary ){
echo $textHelper->shortText( strip_tags($item->get_description()) );
}
?>
</div>


Try changing it to this:

<div class="rssItemSummary">
<?php 
$htmlrss = $item->get_description();
if( $rssObj->showSummary ){
echo $htmlrss;
}
?>
</div>


That should mean HTML is placed into your description area and links should appear. However, I'm unsure how that will look in plain-text emails...

You can do all sorts of filtering and replacing of things on that variable $htmlrss above. There's an automatic read more link back to the RSS article at the end for example that you might not want by the sounds of things, so try using str_replace() to remove it and mess around with other things.

Cheers
bballhermit replied on at Permalink Reply
bballhermit
That method will work well! It is not exactly what I want, but turns the [Link] that shows up in the RSS Reader block from just text to an actual link to the linked URL. It does seem to adjust the formatting, though. Before I applied this fix, my RSS summary would span nearly the whole width of the block. Now, it is kept narrower and breaks onto many new lines. Any ideas why that would be? Thank you.

To see what I mean, you can check out my site at:
http://www.allnationsbiblefellowship.org/...
bballhermit replied on at Permalink Reply
bballhermit
Any ideas why this new link method makes my RSS displayer block take up only have the width of the layout?
osu replied on at Permalink Best Answer Reply
osu
Hi,

Sorry for the late reply, I wasn't getting any emails saying there had been a response.

I can see in your HTML that there are a load of <br /> tags in your RSS feed:

<div class="rssItemSummary"> 
            We have been working hard to update our sermon database. A large <br> amount of messages from the last couple years are now available on our <br> website! If you have an iPod, you can subscribe to the podcast <br> through the link to iTunes. You can also simply listen to the sermons <br> on the website, or download them as .mp3 files. <a href="http://www.allnationsbiblefellowship.org/sermons" rel="nofollow" target="_blank">[link]</a> 
         </div>


The reason they weren't there before is that there was a html tag filter stripping it out. You could try using str_replace on $htmlrss to remove all <br /> tags and maybe replace them with a space (&nbsp;). Like this:

<div class="rssItemSummary">
<?php 
$htmlrss = $item->get_description();
$htmlrss = str_replace("<br>", " ", $htmlrss);
if( $rssObj->showSummary ){
echo $htmlrss;
}
?>
</div>


Hope that helps
bballhermit replied on at Permalink Reply
bballhermit
That worked great! Thank you so much for your help!
311Media replied on at Permalink Reply
311Media
Did the "Read more" code snippet above get addressed?