Posted by vkr11 on June 25, 2008 at 12:08am
I am aggregating Feeds from various site to aggregate at my site. Many of these feeds provide complete post instead of just a summary/teaser. I would like to aggregate only the teasers of these feeds (instead of the complete feed), and let the users go to the complete feed if required.
Is there a way for me to show summary only? At the moment, if the feed it aggregate is a full feed, it will show the full thing as well. I want to trim down the aggregated content, say to only 250 characters.
Thanks,
Victor
Comments
Create a view showing the
Create a view showing the content and select to only show the teaser not the full post.
Kyle Mathews
Kyle Mathews
The feeds that I have is
The feeds that I have is coming from other sites (and not generated at my site). I am using feedapi to aggregate them, so can not really use it with views?
You can use views if you set
You can use views if you set FeedAPI to create nodes instead of the light-weight feeditems.
Kyle Mathews
Kyle Mathews
How?
This sounds great. Can you say how to do this?
truncate_utf8
I like this function for this kind of thing: http://api.drupal.org/api/function/truncate_utf8/5
When used for shortening feeds, I've used it like
<?phpprint truncate_utf8(strip_tags($body), 200, TRUE, TRUE);
?>
That should remove any html tags, crop the body to 200 characters, breaking at a word space, and adding '...' at the end.
Zivtech | Illuminating Technology
Zivtech | Illuminating Technology
I did not know that this
I did not know that this function exists, so far I wrote my own functions to do this. Drupal is always good for a positive surprise.
--
ramiro.org
Is there a way to achieve
Is there a way to achieve this without getting into the PHP programming? If not where should I be adding this piece of code?
Important Topic
I really think this is an important topic. I'm currently using the FeedAPI 6.x-1.x-dev (2008-Sep-18).
One of the things that has always bothered me about aggregation in Drupal is the potential of running into copyright issues when inadvertently displaying the full contents of the feed's original post. There certainly are times when you want to display only the teaser or change the teaser length (and body) of your feed-items to something different from your site's default teaser.
For those using FeedAPI and by taking Lynn's step a little further you can make some minor changes in the FeedAPI's feedapi_node.module. Near line 303 in the function_feedapi_node_save you'll find:
$node->body = $feed_item->description;$node->teaser = node_teaser($feed_item->description);
in which I changed to:
$node->body = truncate_utf8(strip_tags($feed_item->description), 400, TRUE, TRUE);$node->teaser = truncate_utf8(strip_tags($feed_item->description), 200, TRUE, TRUE);
If you're perfectly fine with your default teaser but wish no have the body the same as the teaser, you may want to try:
$node->body = node_teaser($feed_item->description);$node->teaser = node_teaser($feed_item->description);
If there is an easer way to do this using CCK and/or Views...please let me and others know. Either way, I sure wouldn't mind a feature in Drupal's aggregation that allowed you to reduce the body to a size of your own choosing. What do others think?
BryanSD
CMS Report
Bryan Ruby
socPub
Aggregator and RSS Feed Summary
Is there a way to achieve this same functionality in Aggregator?
I've been looking at the following files:
http://api.drupal.org/api/function/truncate_utf8
http://api.drupal.org/api/function/node_teaser/6
I modified the 'teaser_length' to 300 from the original 600 in 'modules/node/node.module' This seems to have truncated the feeds to 300 characters for most of the RSS feeds in my Aggregator except for one feed which continues to show complete articles - basically everything within . I'm a newb and don't know why this is happening and I've been trying to figure this out for days..... The best that I can figure is that for some reason the CDATA protects the text from being truncated.
If this is the case, is there a way to get around this?
Is there a way to capture in Drupal Aggregator just the CDATA text within the field that shows up in RSS readers?
Directly below is what i changed in the node.module file. Underneath that is the html coding for the RSS news feed that will not truncate. I basically want either the summary to show or for the article to be truncated at 300 characters. Please advise and thanks in advance!!
[I added '-' before all the tags because I didn't know how to get them to show otherwise because of the html reading capability of the text box]
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function node_teaser($body, $format = NULL, $size = NULL) {
if (!isset($size)) {
$size = variable_get('teaser_length', 300);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<-item>
<-title>Rihanna's Grandma Speaks Out!<-/title>
<-link>http://perezhilton.com/2009-02-10-rihannas-grandma-speaks-out<-/link>
<-comments>http://perezhilton.com/2009-02-10-rihannas-grandma-speaks-out#respond<-/comments>
<-pubDate>Tue, 10 Feb 2009 20:00:19 +0000<-/pubDate>
<-dc:creator>Perez Hilton<-/dc:creator>
<-category>Rihanna<-/category>
<-category>Legal Matters<-/category>
<-category>Chris Brown<-/category>
<-guid isPermaLink="false">http://perezhilton.com/2009-02-10-rihannas-grandma-speaks-out<-/guid>
<-description>
<-![CDATA[
There's a new development every hour!
While there continues to be no statement/apology from Chris Brown, Team Rihanna is speaking out.
The Umbrella singer's grandmother, Clara Brathwaite, says, "I don't want people to worry. Rihanna is fine and she is doing well."
And she also denies that Rihanna suffered from a broken nose.
If Brown did hit [...]]]><-/description>
<-content:encoded>
<-![CDATA[
There's a new development every hour!
While there continues to be no statement/apology from Chris Brown, Team Rihanna is speaking out.
The Umbrella singer's grandmother, Clara Brathwaite, says, "I don't want people to worry. Rihanna is fine and she is doing well."
And she also denies that Rihanna suffered from a broken nose.
If Brown did hit RiRi, we think he should just fess up to it NOW. That is the best way to begin atoning for his sins!
[Image via WENN.]
]]><-/content:encoded>
<-wfw:commentRss>http://perezhilton.com/2009-02-10-rihannas-grandma-speaks-out/feed/<-/wfw:commentRss>
<-/item>
ReTease
Teasers are cached... check out http://drupal.org/project/retease
Hi, Would with any one of
Hi,
Would with any one of above solutions it be easy to send only the teaser of a node to twitter?
greetings, Martijn
Trim full post - For Drupal 7
Hello,
I adapted the solution given by Lynn (http://groups.drupal.org/node/12694#comment-40925) for my Drupal 7 installation.
I changed the following in aggregator-item.tpl.php.
Original :
<?phpif ($content):
?>
<?phpprint $content;
?>
<?phpendif;
?>
Modification :
<?phpif ($content):
?>
<?phpprint truncate_utf8(strip_tags($content), 200, TRUE, TRUE);
?>
<?phpendif;
?>