I am writing a web program using mvc php framework. I have index and another view which I want to render the view inside of my index. First I call view then I call index and put view into it. My problem is I want to save the whole view into a variable and do something like echo $view in my index. both require_once and include_once will show my view instantly. I want to save the page with it’s variables. Any idea?
Share
Use output buffering functions. For example:
$contentswill now contain the contents of the page without actually outputting anything to the browser. You can then echo the contents where you see fit.