Let's talk about render and renderpartial first. If you want to solve this problem, let's stop here. The key is the difference between render and renderpartial.
Renderpartial () method
| Public StringRenderpartial(String $ view, array $ DATA = NULL, Boolean $ return = false, Boolean $ processoutput = false) |
| $ View |
String |
Name of the view to be rendered. See getviewfile for details about how the View Script is resolved. |
| $ Data |
Array |
Data to be extracted into PHP variables and made available to the View Script |
| $ Return |
Boolean |
Whether the rendering result shocould be returned instead of being displayed to end users |
| $ Processoutput |
Boolean |
Whether the rendering result shocould be postprocessed using processoutput. |
| {Return} |
String |
The rendering result. null if the rendering result is not required. |
$ View is commonly used, that is, the view template returned
$ Data is commonly used, that is, the data attached to the view template.
$ Return: The default value is false, which is generally not used. If it is false, the HTML page is rendered. If it is true, the HTML code is output to you (you can receive the HTML code if you want)
$ Processoutput the default value false is generally not used, but the key to this problem is this parameter. Below are some descriptions of this parameter.
See http://www.yiichina.com/api/CController#processOutput-detail for details
Processoutput () method
| Public StringProcessoutput(String $ output) |
| $ Output |
String |
The output generated by the current action |
| {Return} |
String |
The output that has been processed. |
Source code:Framework/web/ccontroller. php #350 (
Display)
Postprocesses the output generated by render (). this method is invoked at the end of render () and rendertext (). if there are registered client scripts, this method will insert them into the output at appropriate places. if there are dynamic contents, they will also be inserted. this method may also save the persistent page states in hidden fields of stateful forms in the page.
In my personal understanding, it refers to whether to load js css with registration. If it is false, it is not loaded; if it is true, it is loaded.
===( The following are some explanations on this issue from the Internet) ========================================================== ======================================
Original http://blog.sina.com.cn/s/blog_7d0c4ede0101glhk.html
Log on to the background and call the verification code. Click the verification code without refreshing. No response is returned (All verification code configurations and parameters are correct ). When an error is found, it is found that the page that can refresh the verification code has a piece of JS Code more than the page that cannot refresh the verification code to handle the click Verification Code refresh event.
Why is a piece of code missing? It turns out that the controller calls renderpartial and render respectively. The following describes their differences:
During page output rendering.
Render outputs the content of the parent template and embeds the rendered content into the parent template.
Renderpartial does not output the content of the parent template. Only the partial content of this rendering is output.
There is also an important difference:
The render function executes the processoutput ($ output) function by default, and registers components, such as the scripts registered in cclientscript in ctreeview, for rendering and output.
Renderpartial () does not automatically render the output client script by default. You need to specify the parameters before the output:
Renderpartial ($ view, $ DATA = NULL, $ return = false, $ processoutput = false)
Set processoutput to true.
Just like the problem we encountered, when using renderpartial, the page did not output the verification code to refresh that JS. So there is no response.
Difference between render and renderpartial
Render and renderpartial both belong to methods in ccontroller
Yiichina
Renderpartial http://www.yiichina.com/api/CController#renderPartial-detail
Render http://www.yiichina.com/api/CController#render-detail
Blog
Http://tofar.blog.163.com/blog/static/20402210620126124311981/