sure, it's copied straight out of the tutorial:

[u...@staging cakedir]# cat app/controllers/posts_controller.php
<?php
class PostsController extends AppController {

        var $name = 'Posts';

        function index() {
                $this->set('posts', $this->Post->find('all'));
        }
}
?>

and:

[r...@staging cakedir]# cat app/views/posts/index.ctp
<!-- File: /app/views/posts/index.ctp -->

<h1>Blog posts</h1>
<table>
        <tr>
                <th>Id</th>
                <th>Title</th>
                <th>Created</th>
        </tr>

        <!-- Here is where we loop through our $posts array, printing
out post info -->

        <?php foreach ($posts as $post): ?>
        <tr>
                <td><?php echo $post['Post']['id']; ?></td>
                <td>
                        <?php echo $html->link($post['Post']
['title'],
"/posts/view/".$post['Post']['id']); ?>
                </td>
                <td><?php echo $post['Post']['created']; ?></td>
        </tr>
        <?php endforeach; ?>

</table>

***** for what it's worth, I went into:

/app/webroot/index.php

and put in this debugging line,

echo "url: $url";
exit;

right before:

$Dispatcher->dispatch($url);

and the output in http://server/posts/index

was:

url:

I don't know how CakePHP is supposed to work, but should this $url
variable be set to a value other than ''?  I can't tell from the code
where this variable is supposed to be set in the first place.  Unless
it's supposed to be referencing $_GET['url'] but that would scare me a
bit.

On May 28, 1:22 pm, Miles J <[email protected]> wrote:
> Can I see your index actions code? And the view for it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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