Organizing templates in subfolders?

I just found a better way to do this. Sorry for reviving the topic, but I think this is an important feature for bigger websites.

You need to add the next definition to your routing

  array(
    'pattern' => 'folder/(:any)',
    'action'  => function($page) {
              $site = kirby()->site();
              $page = page('folder')->children()->find($page);
              tpl::load(kirby()->roots()->templates() . DS . "folder/$page.php", array('site' => $site,'page' => $page), false);
        },
    'method' => 'GET|POST',
  )

this will work, and you cas use different blueprints for every oage as it loads the right page into the $page variable.

2 Likes