Hello-

I'm having the weirdest Cake error with my code. When the code below calls 
the add() method (also reproduced here and from a different controller), 
the code redirects him back the edit() action (in essence, to the user it 
appears as if nothing happens). To further complicate matters, when I call 
the same URL when I'm not on that page (despite the pages not being reliant 
on each other), I get redirected to the base of my app, which results in a 
redirect loop. I tried calling other methods from this controller (with 
their proper arguments) to see if this was just a problem with the add() 
action, but I get the same redirect loop.

Here is the relevant code:
 function edit($id=null) {
 if(!$id) {
 $this->Session->setFlash('Invalid!');
$this->redirect(array(
'action' => 'index')
);

 }
 else {
 //Get the slides themselves
$slides = $this->Slide->find('all', array('conditions' => 
array('Slide.module_id' => $id)));
$this->set('slides', $slides);
//Get the data for the Module
$module = $this->Module->find('first',
array(
'conditions' => array (
'Module.id' => $id
),
'fields' => array(
'Module.module_name',
'Module.id')
)
);
 }
 }
And here is the add() code (again, from a different module):
function add($module = null) {
if ($this->request->is('get')) {
                        //Set some variables for the view (this code I know 
works as it has been used successfully elsewhere
} 
else { //User is POSTing
$this->Slide->create();
$this->Slide->save($this->data);
}
}

Thanks to everyone in advance; I couldn't do this without your support!

Andrew

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to