Parse error: syntax error, unexpected T_ENDFOREACH

I’m just messing around, trying to work through a tutorial but I’m getting an error I can’t figure out.

Parse error: syntax error, unexpected T_ENDFOREACH in /Applications/MAMP/htdocs/tut_blog/app/views/posts/index.ctp on line 15

Here is the file…

View All Posts

<?php foreach ($posts as $post); ?>
<?php endforeach; ?>
Title Body
<?php echo $post['Post'] ['title']; ?> <?php echo $post['Post']['body']; ?>

Any ideas???

You post two times, but i post you the solution :

[php]

View All Posts

<?php foreach ($posts as $post){ ?> <?php } ?>
Title Body
<?php echo $post['Post'] ['title']; ?> <?php echo $post['Post']['body']; ?>
[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service