That var was meant as a placeholder in order for you to change to whatever fitted you.. so yeah.. that could be the problem :)..
2009/7/8 menashe morobuse <[email protected]> > > i get something like > > Undefined variable: task_id [APP\views\notes\add.ctp, line 7] > > I've changed this: > > *echo $html->link('Add > note','/note/add/$task_id_variable',array('title'=>'Add note'));* > > to: > > *echo $html->link('Add > note','/note/add/$task['Task']['id'],array('title'=>'Add note'));* > > is that the problem? > > On Jul 8, 6:51 am, Carlos Gonzalez Lavin <[email protected]> > wrote: > > Aight.. code it is > > Add a link somewhere in the task view such as: > > > > *echo $html->link('Add > > note','/note/add/$task_id_variable',array('title'=>'Add note'));* > > > > (which could be even sexier if you used an array for the link, but let's > > leave it like this to start) > > > > Then, in the note controller: > > > > *function add($task_id){* > > *..codecodecode* > > *$this->set(compact('task_id'));* > > *...codecodecode* > > *}* > > > > Finally, in your add note view: > > > > *echo $form->hidden('task_id',array('value' => $task_id));* > > * > > * > > Let us know how it went :) > > > > 2009/7/8 menashe morobuse <[email protected]> > > > > > > > > > like i wrote... > > > i am kind of a noob in it... > > > can u please help me out with this? > > > thanks > > > > > On Jul 8, 6:24 am, Carlos Gonzalez Lavin <[email protected]> > > > wrote: > > > > How about you send the current task id as a parameter to the "add" > action > > > in > > > > the "note" controller (as in 'app/note/add/3'... or something a bit > > > better > > > > looking)... then just put it in a hidden field? > > > > There's also the adding the current task id to the session and > retrieving > > > it > > > > when adding a note.. but I believe the first method is far more > simple > > > > > > 2009/7/7 menashe morobuse <[email protected]> > > > > > > > i've already done that... > > > > > > > what i meant was when i add a comment it will automatically will > know > > > > > which task i am coming from and will > > > > > choose it without me having to choose it > > > > > > > for example: > > > > > > > i am athttp://...app/tasks/view/3 > > > > > > > pressing on "new note" button will give me the form > > > > > > > title (add here) > > > > > note (add text here) > > > > > > > and that's it... > > > > > no pull down menu to choose task > > > > > > > makes sense? > > > > > > > thanks > > > > > > > On Jul 8, 2:22 am, GravyFace <[email protected]> wrote: > > > > > > If you set up your proper model associations, it should be done > > > > > > automatically when you echo $form->input('task_id'); > > > > > > > > Give the bake console a try first and bake your entire project > > > > > > (Models, Views, Controllers) -- it helped me immensely doing it > that > > > > > > way the second time around vs. slogging through my first app > doing > > > > > > things from scratch. > > > > > > > > On Tue, Jul 7, 2009 at 4:44 PM, menashe morobuse< > [email protected]> > > > > > wrote: > > > > > > > > > for example i am having the following db setup... > > > > > > > > > tasks > > > > > > > id (auto increment) (PK) > > > > > > > name > > > > > > > > > notes > > > > > > > id (auto increment) (PK) > > > > > > > task_id > > > > > > > text > > > > > > > > > the question is how can i pass in the create view the task id > and > > > auto > > > > > > > fill it... > > > > > > > meaning that i won't have to select it via a pull down menu... > > > > > > > > > as u probably guess i am a complete noob... > > > > > > > so please be gentle :) > > > > > > > > > thanks > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
