Yes brian is right.

If you are sending the project id to the view through

 $project_id = $this->params['Project']['id'];

Then you have to send that variable to the view by $this->set method.

Compact is the optimized  way to use set.

So please read the Compact method first clearly then use it carefully.

http://robwilkerson.org/2008/12/28/cakephp-watch-out-for-the-compact-function/
Please read this.

On Thu, Jul 9, 2009 at 6:13 AM, brian <[email protected]> wrote:

>
> You're setting a variable named $projects, not $project. So are you
> creating the 'Add Sequence' links in a loop?
>
> Put a debug($projects) line in your view.
>
> On Wed, Jul 8, 2009 at 5:19 PM, menashe morobuse<[email protected]>
> wrote:
> >
> > my projects/view view has a line like this...
> >
> > <li><?php echo $html->link('Add Sequence','/sequences/add/'.$project
> > ['Project']['id'],array('title'=>'Add Sequence')); ?></li>
> >
> > then my sequences/add view has this:
> >
> > echo $form->hidden('project_id',array('value' => $project_id));
> >
> > and my sequenceController controller has this...
> >
> >        function add($project_id) {
> >                if (!empty($this->data)) {
> >                        $project_id = $this->params['Project']['id'];
> >                        $this->Sequence->create();
> >                        if ($this->Sequence->save($this->data)) {
> >                                $this->set('project_id',$project_id);
> >                                $this->Session->setFlash(__('The Sequence
> has been saved', true));
> >                                $this->redirect(array('action'=>'index'));
> >                        } else {
> >                                $this->Session->setFlash(__('The Sequence
> could not be saved.
> > Please, try again.', true));
> >                        }
> >                }
> >                $projects = $this->Sequence->Project->find('list');
> >                $this->set(compact('projects'));
> >        }
> >
> > what am i doing wrong...
> >
> > i want that when creating new sequences they will automatically be
> > assigned the project id...
> >
> > thanks
> >
> >
> > >
> >
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to