Render page without theme

Permalink 1 user found helpful
Hi

Is it possible render page without theme?

I'm building my own package for concrete5 and I want to render basic html-view. So I don't want any theme files there. Is it possible?

Now I'm trying in controller.php
<code>
public function view() {
$ul = new UserList();
$users = $ul->get();
$this->set('users', $users);
$this->set('view', 'list');
$this->render('test.php');
}
</code>

 
xaritas replied on at Permalink Reply
Probably a bit late for the person who originally asked, but others might get here through Google as I did. Looking at the code (5.5.1), there is no hook before the default.php or view.php is applied, and no easy way to supply an alternate wrapper to those two, without some fairly brittle meta-programming or code injection. So I think the sanest way is to simply create an alternate theme, say, "my-project-unstyled" with empty default.php and view.php files. In a controller action, you can do this:

$v = View::getInstance();
    $theme = PageTheme::getByHandle('my-project-unstyled');
    $v->setTheme($theme);
    $this->render("my-undecorated-page");


Then put your code into "mypackage/themes/my-project-unstyled/my-undecorate-page.php" and you're good to go. The downside to this is that you may have to duplicate some assets, or figure out how to point to existing ones in the other theme (or in the package directory).