you may leave it out in this case.
its always good practice to specify the controller, as well, though.
but if you are outside of this controller you MUST specify it
so better include it everywhere. especially if you move code around
(copy and paste)
or if you make it an element (which could be included in any other
view/controller/layout.
so better safe than sry :)
we programmers are just lazy sometimes
On 31 Okt., 20:28, "Yves S. Garret" <yoursurrogate...@gmail.com>
wrote:
> I just noticed this in the cakephp book. In the first example, you have
> the following line(s) in index.ctp:
>
> http://book.cakephp.org/view/1536/Creating-Post-Views
>
> <?php echo $this->Html->link($post['Post']['title'], array('controller' =>
> 'posts', 'action' => 'view', $post['Post']['id'])); ?> <--- this is the
> first example of a view
>
> http://book.cakephp.org/view/1540/Editing-Posts
>
> <?php echo $this->Html->link($post['Post']['title'], array('action' =>
> 'view', $post['Post']['id']));?> <--- this is a later example, when you're
> editing the post.
>
> The question is about this line: 'controller' => 'posts' <--- this doesn't
> seem to affect the way info is posted. index.ctp is already tied to the
> index method in the PostsController, so what role does this play?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment