Render a page through a specific template
Permalink
I wanted to share something really quick that I'd been battling with.
I wanted to set a theme from a controller in a single page and render a page through that theme. In my case specifically, I was trying to figure out the easiest way to render a page through a lightbox dialog without any theme or template elements around it.
The solution I found on line 66 of src/Page/View/PageView.php
I created "template" that I wanted to render the code through in application/themes/core and named it "blank".
Then, in rendering my page view for the dialog, I called "blank" as a parameter in render:
I couldn't find any documentation on the second parameter for render, hope it helps someone!
I wanted to set a theme from a controller in a single page and render a page through that theme. In my case specifically, I was trying to figure out the easiest way to render a page through a lightbox dialog without any theme or template elements around it.
The solution I found on line 66 of src/Page/View/PageView.php
I created "template" that I wanted to render the code through in application/themes/core and named it "blank".
Then, in rendering my page view for the dialog, I called "blank" as a parameter in render:
//get some stuff from the database $db = Loader::db(); $q = $db->getRow("SELECT * FROM some_table WHERE group_id = :group_id", array("group_id"=>$id)); //set that data to pass into my rendered page $this->set("q", $q); //render the page through my core template I created with all my javascript, css, etc $this->render('some/single/page', 'blank'); //renders page through /themes/core/blank
I couldn't find any documentation on the second parameter for render, hope it helps someone!