logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$40
Make the RSS feeds look pretty in Netvibes

Hey, everyone, I am overwhelmed with work this weekend so I am going to outsource 2 small projects to the excellent programmers of Symfony Experts.

This project is going to use NetVibes as the reference RSS reader, so you will need to get a NetVibes account, if you do not already have one. It is free and takes about 30 seconds to sign up.

I would like to fix the RSS feeds. Check out the screen shot I have uploaded with this question. See how the content lacks line breaks? I need that fixed.

Also check out the RSS we output on WP Questions.

We are using the sfFeed2 plugin, though we could switch to another if someone suggests something good.

Here is the code I wrote when we created the site, I have not had the time to clean this up:

  public function executeIndex(sfWebRequest $request)
{
$order = $request->getParameter('order');
$sort = $request->getParameter('sort');
if (!$sort) $sort = "end_at";
$c = new Criteria();
$sort = strtoupper($sort);
$c->add(QuestionsAndResponsesPeer::END_AT, date('Y-m-d H:i:s'), Criteria::GREATER_THAN);
$c->add(QuestionsAndResponsesPeer::STATUS, 'active');
if ($order == "desc") {
$c->addDescendingOrderByColumn("questions_and_responses.$sort");
} else {
$c->addAscendingOrderByColumn("questions_and_responses.$sort");
}
$c->setLimit(20);
$posts = QuestionsAndResponsesPeer::doSelect($c);

$title = "";
if (strtolower($sort) == 'end_at') $title = " Questions that end soon on ";
if (strtolower($sort) == 'responses') $title = " Questions with the most responses on ";
if (strtolower($sort) == 'created_at') $title = " Recent questions on ";
if (strtolower($sort) == 'prize_amount') $title = " Questions with the biggest prizes on ";

$siteUrl = "http://" . $request->getHost();
$sort = strtolower($sort);

$feed = new sfAtom1Feed();
$feed->setTitle($title . ' ' . sfConfig::get('app_subdomain_specific_info_nice_name_for_site'));
$feed->setLink($siteUrl.'/question/index?sort='.$sort.'&order='.$order);
$feed->setAuthorEmail(sfConfig::get('app_subdomain_specific_info_email'));
$feed->setAuthorName( sfConfig::get('app_subdomain_specific_info_nice_name_for_site') );

$feedImage = new sfFeedImage();
$feedImage->setFavicon($siteUrl . 'favicon.ico');

foreach ($posts as $post)
{
$item = new sfFeedItem();
$item->setTitle($post->getSubject());
$item->setLink($siteUrl.'/question/show/id/'.$post->getId());
$item->setAuthorName($post->getsfGuardUser()->getProfile()->getNiceName());
$item->setPubdate($post->getCreatedAt('U'));
$item->setUniqueId('/question/show/id/'.$post->getId());
$item->setCategories(array($post->getPrizeAmount()));
$description = $post->getDescription();
$description = str_replace(">", ">", $description);
$description = str_replace("&lt;", "<", $description);
$description = str_replace("<p>", "<br /> \n", $description);
$description = str_replace(" $description = str_replace("", " ", $description);
$description = str_replace("&nbsp;", " ", $description);
$description = str_replace("&", " ", $description);
$item->setContent($description);
$item->setDescription($description);

$feed->addItem($item);
}

$this->feed = $feed;

}



Please note, if you can upload a screenshot of NetVibes, with the content looking good, I will be much more likely to give you money than if you do not upload such a screenshot.

Thanks to everyone.

This question has been answered.

attachment image asker uploaded image

Lawrence Krubner | 05/16/10 at 3:37pm Edit


(3) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    05/30/10
    10:57pm
    Bill Hunt says:

    Hey lawrence, I think the main part will be cleaned up if you switch this order up:


    $description = str_replace("&", " ", $description); // Rogue ampersands First
    $description = str_replace("<p>", "<br /> \n", $description);
    $description = str_replace(" // This line broke in your post - not sure what's supposed to go here?
    $description = str_replace("", " ", $description);
    $description = str_replace("&nbsp;", " ", $description);

    // Tags *last*
    $description = str_replace("&gt;", ">", $description);
    $description = str_replace("&lt;", "<", $description);

  • avatar
    Last edited:
    05/17/10
    11:34am
    Lawrence Krubner says:

    Do you have time to work on this Bill? I can give you access to our Subversion server.

  • avatar
    Last edited:
    05/17/10
    11:35am
    Bill Hunt says:

    Sure thing. :)

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.