I think it has more to do with belt and braces than laziness. I always add the 
controller because I want to be sure it goes where I want it to go, rather than 
letting Cake (potentially) decide for me.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 1 Nov 2011, at 09:21, WebbedIT wrote:

> It's not lazyness per se, both are completely valid and it's up to you
> to decide which to use in what circumstances.  If you are 100% certain
> that the view containing the link will only ever be called from a
> certain controller, then you do not need to include that controller in
> the url array as the controller being used at the time will be
> inserted.
> 
> There are many different ways to specify arguments/params for most
> functions ... just learn all of those ways and use the right one for
> you in the right circumstances.
> 
> HTH, Paul
> 
> On Oct 31, 8:12 pm, "Yves S. Garret" <yoursurrogate...@gmail.com>
> wrote:
>> I got a pet peeve about being 'lazy' :-) .  Too often it leaves vague code
>> that some poor soul needs to update years after the fact, with little
>> understanding of what's going on.
>> 
>> I'll specify the exact controller.
>> 
>> On Mon, Oct 31, 2011 at 3:41 PM, euromark <dereurom...@googlemail.com>wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> both will work exactly the same WITHIN the controller
>>> 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 sitehttp://ask.cakephp.organd help
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>>> athttp://groups.google.com/group/cake-php
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to