Code looks good. If you're sure that the $posts contains any content, I really don't know what's wrong.

IMHO, it's something with the database and/or the findAll statement. You can also try decomposing the problem into which part of Cake (the model, view, or controller).

My first step would be checking out that $posts variable by adding debug($posts); line on the view.

On 11/13/06, Eric < [EMAIL PROTECTED]> wrote:

--------- /app/views/layouts the file rss.thtml-------   I paste it
from the tutorial


<?php echo $content_for_layout; ?>

----------PostsController-----
<?php
class PostsController extends AppController
{
        //var $scaffold;
        var $name = 'Posts';

        function index() {
                $this->Post->recursive = 0;
                $this->set('posts', $this->Post->findAll());
        }


    function rss()
   {
    $this->layout = 'rss';
    $this->set('posts', $this->Post->findAll("","",
                "modified DESC", // Sort order
            2 // Number to be returned
            ));
   }

-------rss.thtml------

<?php
    vendor("feedcreator.class");

    $rss = new UniversalFeedCreator();
    $rss->title = "my title";
    $rss->description = "my description";
    $rss->link = "my link";
    $rss->syndicationURL = "my syndication url";
    // Initialize the cssStyleSheet var, needed to avoid an error with
FeedCreator version 1.7.2-mod (latest version at time of writing)
    $rss->cssStyleSheet = "";


    foreach ($posts as $post)
    {
        $item = new FeedItem();
        $item->title = $post['Post']['title'];
        $item->link = "link";
        $item->description = $post['Post']['body'];
        $newdate = $post['Post']['created'];
        list($date,$hours) = split(' ', $newdate);
        list($year,$month,$day) = split('-', $date);
        list($hour,$min,$sec) = split(':', $hours);
        $date = date("r", mktime($hour, $min, $sec, $month, $day,
$year));
        $item->date = $date;
        $item->source = "source";
        $item->author = "author";

        $rss->addItem($item);
    }

    $rss->saveFeed();
?>


Thanks





--
Adrian Godong
[EMAIL PROTECTED]

Microsoft Student Ambassador
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to