Novice parse error T_DOUBLE_ARROW [closed]
I'm starting to make my first steps into CakePHP 1.3, and I'm having a parse error I can't find. I'm trying the main tutorial and encountering this error:
Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ')' in /Applications/XAMPP/xamppfiles/htdocs/mysite.com/app/views/posts/index.ctp on line 11
the file affected is:
<h1>Posts</h1>
<table>
<tr>
<th>ID</th>
<th>Title</th>
<th>Creation date</th>
</tr>
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Post']['id']; ?></td>
<td><?php echo $this->Html->link($post['Post']['title'], array ('controller', => 'posts', 'action' => 'view', $post['Post']['id'])); ?></td>
<td><?php echo $post['Post']['created']; ?></td>
</tr>
<?php endforeach; ?>
</table>
Where am I wrong?
In this line
<td><?php echo $this->Html->link($post['Post']['title'], array ('controller', => 'posts', 'action' => 'view', $post['Post']['id'])); ?></td>
you need to remove the , after controller.
And I think you need to add an ) after ´view´
精彩评论