Jeremy Burns
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 codethat some poor soul needs to update years after the fact, with littleunderstanding 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 controlleryou 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 itso 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 otherview/controller/layout.so better safe than sry :)we programmers are just lazy sometimesOn 31 Okt., 20:28, "Yves S. Garret" <yoursurrogate...@gmail.com>wrote:I just noticed this in the cakephp book. In the first example, you havethe 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 thefirst example of a viewhttp://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, whenyou'reediting the post.The question is about this line: 'controller' => 'posts' <--- thisdoesn'tseem to affect the way info is posted. index.ctp is already tied to theindex method in the PostsController, so what role does this play?--Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.orgCheck out the new CakePHP Questions sitehttp://ask.cakephp.organd helpothers with their CakePHP related questions.To unsubscribe from this group, send email tocake-php+unsubscribe@googlegroups.com For more options, visit this groupathttp://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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment