BlindPenguin Posted June 9, 2022 Share Posted June 9, 2022 (edited) Hi there, I'm currently testing Processwire in combination with Wireframe. Right now, i'm trying to get it to use the Layout file i've defined. But for some reason it doesn't work. Maybe i'm doing it wrong. I defined "wireframe" in all my templates and added the file "wireframe.php" with this content: $wireframe = $modules->get('Wireframe'); $wireframe->init(); // render the page echo $wireframe->render(); Layout (filename default.php inside the layouts folder): <!doctype html> <html lang="<?= $this->lang ?>"> <head> <!-- metadata --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="ProcessWire CMS/CMF"> <?php if ($page->meta_description): ?> <meta name="description" content="<?= $page->meta_description ?>"> <?php endif; ?> <?php if ($page->meta_keywords): ?> <meta name="keywords" content="<?= $page->meta_keywords ?>"> <?php endif; ?> <!-- page title --> <title><?= $page->title ?></title> <!-- stylesheets --> <link rel="stylesheet" href="<?= $config->urls->resources ?>styles/main.css"> </head> <body class="template-<?= $page->template ?>"> <main> <h2>TEST</h2> <div id="content"><?= $placeholders->default ?></div> </main> <script src="<?= $config->urls->resources ?>js/main.js"></script> </body> </html> Then here's the view for "home" in home folder inside views: <?php namespace ProcessWire; /** @var $placeholders */ ?> <div id="content"> <h1><?= $page->title ?></h1> </div> If i've understood it right, the view is supposed to go be printed inside the layout file. But the actual out put in the browser is like this: <div id="content"> <h1>Home</h1> </div> So something on the way is going wrong here. And i'm not sure what exactly. I thought it should print into that "$placeholder" stuff? I used Laravel and Django before, so i'm familiar with the theory behind it. Just need a push in the right direction. ? Edited June 9, 2022 by BlindPenguin Found it out myself Link to comment Share on other sites More sharing options...
BlindPenguin Posted June 9, 2022 Author Share Posted June 9, 2022 Alright, i think i've figured it out. The location of the layout file is wrong. According to the docs it's supposed to go into "templates/views/layouts", but according to the boilerplate it's actually in "templates/layouts". Putting it in there makes it work. Didn't expect that. 4 Link to comment Share on other sites More sharing options...
bernhard Posted June 9, 2022 Share Posted June 9, 2022 Glad you got it sorted. Welcome to the forum @BlindPenguin - I hope you enjoy exploring PW ? Maybe @teppo wants to update the docs? 1 Link to comment Share on other sites More sharing options...
teppo Posted June 12, 2022 Share Posted June 12, 2022 On 6/9/2022 at 10:54 PM, BlindPenguin said: Alright, i think i've figured it out. The location of the layout file is wrong. According to the docs it's supposed to go into "templates/views/layouts", but according to the boilerplate it's actually in "templates/layouts". Putting it in there makes it work. Didn't expect that. Thanks for the heads-up — docs were out of sync with current structure. Updated now! Just for the record, layouts used to live in /site/templates/views/layouts/, but based on user feedback the "views" part was removed and now it's just /site/templates/layouts/. 1 Link to comment Share on other sites More sharing options...
BlindPenguin Posted June 12, 2022 Author Share Posted June 12, 2022 Nice. Thanks for the quick update. ? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now