CodeIgniter: Loading view in new window

2019-06-14 07:37发布

问题:

Im writing a script that allows users to preview their reports before saving them to the database using CodeIgniter.

Using the $this->load->view('preview_report', $data); tag.

Is there anything i can add to this string to make it load into a new browser window?

回答1:

If you have different functions (or controllers) for creating and previewing reports, for example http://localhost/appname/report/create and http://localhost/appname/report/preview, you can open new browser window when calling preview function, using basic stuff like

<a href="http://localhost/appname/report/preview" target="_blank" >PREVIEW REPORT</a>

and your report will open in new window. if this is what you want.



回答2:

If 'load into a new browser' refers to 'popup window', then I don't think PHP itself can help you create popup window without the use of Javascript.

Have a look at this page: http://codeigniter.com/forums/viewthread/61395/#302107