In CakePHP, when you click a specific link,
Before displaying another page in a new window, I would like to reload the original page.
Is that possible?
/**UserController**/
public function hogehoge($user_id=0){
// DB update processing is performed here
$this->User->id=$user_id;
$this->User->saveField('is_new', false);
// Reload original page
// Redirect to another page
$this->redirect('http://hogehoge.jp');
}
Before performing the above processing, use the following description in View:
Launching a new window
<?php
// Description in index.ctp
$this->Html->link('GO', 'hogehoge/'.$user_id, array('target'=>'_blank'));
?>
Can you do that?
I can't.
However, there is a condition that says, "In the hogehoge
method on the CakePHP side" as you mentioned in the code example.
When the hogehoge
method is called in the form you describe, the browser interprets the response as for a "new window" and cannot embed instructions or information about the "original page" in it.
If you have the requirement to reload the original page (whether or not CakePHP) before viewing another page in a new window when you click on a specific link, you will have to use JavaScript on the original page side.
It's not that you shouldn't use JavaScript in CakePHP, but considering the code example in your question, I think it's a different topic.If you want to run from JavaScript in the original page, reloading the original page or displaying another page in a new window is not that much code.If you find something you don't understand after looking it up yourself, why don't you make another question thread at that time?
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 PHP ssh2_scp_send fails to send files as intended
578 Understanding How to Configure Google API Key
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.