How To Render() A $Variable?

Hi there, my question is pretty straight forward.

[color="#0000FF"]How can I render a full-page (View + Layout) but without using a file?[/color]

I’m constructing a CMS in a SaaS for multiple tenants, so obviously I can’t use a file for each page and domain, but as far as I can understand…


This renders the [view file] "index.php" + [layout file]"main.php".

so I would like to do something like that:


Anyone have a clever approach? O0

"cache" maybe?


try this


check this for more details

if the output contains both content and layout just use echo

echo $your_output;


Thank you for your reply,

but the idea is to have a full render(view + layout) and echo or cache the output.

or maybe what I’m asking is not that…

how could I trigger an action without a function in the controller?


public function actionIndex()




to something dynamic like:

	public function actionDynamic( $output)


		$this->render( $output );


I hope you see what I’m trying to get at :D

Since the dynamic action haven’t different logic by another dynamic action, it should be only one!

you could make actionTheOne($id)

and according to $id you render the appropriate view

also there is a similar way to do that without creates an action, and I am sure that you have already used it.