Reputation: 123
I have 2 view files, lets say file1.ctp
and file2.ctp
. What I want, when I am successfully done doing something in file1.ctp
, it'll show me a "Successful" message and redirect me to file2.ctp
. It should be automatic.
Upvotes: 0
Views: 94
Reputation: 66339
From this comment, what you're describing is Controller::flash
:
Controller::flash($message, $url, $pause, $layout)
Like redirect(), the flash() method is used to direct a user to a new page after an operation. The flash() method is different in that it shows a message before passing the user on to another URL.
Consider 2 controller actions, like so:
function step1() {
...
$this->flash('Step1 complete, now starting step2', array('action' => 'step2'))
}
function step2() {
...
}
which when accessed at /example/step1
would execute the controller action, then show a plain page with the text Step1 complete, now starting step2
, pause for 1 second (the default) and then send the user to /example/step2
using a meta refresh.
Upvotes: 2
Reputation: 4723
You can use the render function in CakePHP. Like This:
$this->render('file2');
You should use this in your Controller.
Upvotes: 2