Hi all -
2 newbie questions, as I'm new to php and new to cakephp (much previous
asp).
1) In my cakephp readings, I've seen that you're supposed to call
exit() after a redirect(). Thus in this action:
function add($uid=null,$yuid=null) {
if(!$uid OR !$yuid) {
$this->Session->setFlash('You have to be logged in to
do that!');
$this->redirect('/users/index');
exit();
} else {
if($this->othAuth->user('id') == $uid) {
if($this->Video->save(array('Video' =>
array('user_id' => $uid,
'author' => $yuid)))) {
$this->Session->setFlash('The Video has
been added to your
profile!<br />You will need to upload to Youtube.com according the
instructions you received when you registered!');
$this->redirect('/users/view/' . $uid);
exit();
} else {
$this->Session->setFlash('Error: Video
could not be saved!.');
$this->redirect('/users/view/' . $uid);
exit();
}
} else {
$this->Session->setFlash('Error: You can only
add a video for your
own User Profile!');
$this->redirect('/users/view/' .
$this->othAuth->user('id'));
exit();
}
}
}
Seems like I wouldn't need the exit(), because nothing follows the
redirects within the if or else blocks. Just curious if there's some
magic cleanup that exit() does, like setting an object to "nothing" in
asp.
2) Can you call render() from a different controller? Like the above
snip is from my videos_controller, instead of the
"$this->redirect('/users/view/' . $uid);", could I render() something
in my users_controller? I've tried several things, but doesn't seem
to work. Just curious.
Thanks for the great framework, it's allowed a noob like me to really
get my feet wet quickly.
Regards,
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---