I am looking for a way to leverage all of the native functionality of YII when rendering full page (include html/head/body tags). These pages will change fairly regularly, so I am hoping I can store the views/layouts in a db/table, pull them in with the controller action and apply the layout/views appropriately.
Thanks jodev for the repies… I’m going to share some specific examples to illustrate.
Unless I am missing a step, the default functionality is that in the controller, you set the PATH to the layout, anything “echo’d” during the action will be placed into the “content” variable of the layout. render (for view files) and renderText (for code strings) if $returns is set to false, they natively echo out, and are "captured’ for the content variable in the layout.
I would like to define layout in the INIT of the controller or the beforeAction, and set the layout to a code string instead of a PATH. In that code string, I would like to have some sort of token (or $content variable), that could then be replaced wtih anything “echo’d” from the action.
A final unmentioned step, but kind of the whole reason I am exploring this line of thinking…
[list=1]step 1, using outputfilter for cache, check if page is cached, if yes, extract cached portion, skip step 3 and 4step 2, initialize layout and view of pagestep 3, render page (i assume by echoing from the action), including injecting client scripts and styles into their appropriate locations.step 4, cache page (from contents echoed in step 3)step 5, replace tokens from output cache will realtime information using afterActionactually output the entire, fully rendered (and tokens replaced) page.[/list]
Apologies for the late reply. I’m not sure about the answer to your last questions. I’ve been away from Yii for a while, but picking it up again lately. I don’t know enough yet about Yii internal caching system to say what is or is not possible, so I hope someone else can help you find the answer.