search
top

QuickTip: Pesky missing layout when requesting extensions

In CakePHP you can use a different layout (other than default.ctp) for all your views by simply changing the $layout property in your controller. I use this to deliver a different layout for, let’s say, the admin panel of the application – or maybe a member area. Let’s stick with the admin panel example: $this->layout = 'admin'; Now we all do some neat Ajax or XML here and there... read more

Force download a custom view using MediaView

Just some quick hint: Let’s assume you generate a non-html file using a view, layout and custom extension (sql, xml, json, etc..) and you want to offer the displayed result as a download. – Generally you would need to force-download the file, probably using MediaView. Problem is that it isn’t actually a real file for MediaView to work with. Here’s a quick workaround to that, using... read more
 Page 1 of 2  1  2 »
top