CodeIgniter Forums
want to use $this->template->render(); with __destruct - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: want to use $this->template->render(); with __destruct (/showthread.php?tid=22454)



want to use $this->template->render(); with __destruct - El Forum - 09-10-2009

[eluser]Unknown[/eluser]
Hi there, I was just wondering if anyone has the codeigniter template system setup so they assign all their views and content to the $template variable and render() on the __destruct of a controller?

Instead of $this->template->render(); in every controller function. I tried doing it on __destruct but it didn't seem to work for me. I haven't had a look at the $template code but was wondering if anyone has tried this?

thanks


want to use $this->template->render(); with __destruct - El Forum - 09-10-2009

[eluser]Dam1an[/eluser]
__deconstruct won't get caled till after the page has been sent to the browser
You could try using a hook