Kirby Theme Loader

Maybe. I don’t have a UI, but yes, the controllers control which pieces should be used and even what data they should have.

I still use this solution:

A simplified version would be something like this:

<?php
return function($site, $pages, $page) {
  return array(
    'sidebar' => array('news', 'ratings'),
    'main' => array('content1', 'content2', 'table1'),
    'content1' => array('about'),
  );
};

In real life it looks more like this on my site:

<?php
return function($site, $pages, $page) {
  return array(
    'snippets' => [
      'main' => [
        [
          'wrap' => 'section',
          'snippet' => 'facts'
        ],
        [
          'wrap' => 'section',
          'snippet' => 'reviews'
        ],
        [
          'wrap' => 'section',
          'snippet' => 'contact'
        ],
        [
          'wrap' => 'section',
          'snippet' => 'service'
        ],
        [
          'wrap' => 'section',
          'snippet' => 'action'
        ],
      ],
    ],
    'facts' => [
      [
        'label' => 'Belopp',
        'value' => interval('old_customer_min', 'old_customer_max'),
      ],
      [
        'label' => 'Identifiering',
        'value' => single('verify_ways'),
      ],
      [
        'label' => 'Inkomstkrav',
        'value' => single('year_income_min'),
      ],
      [
        'label' => 'Betalningsanmärkning',
        'value' => single('accepted_payment_mark'),
      ],
    ],
    'content' => kirbytext( $page->seo_content() ),
    'excerpt' => kirbytext( $page->excerpt() ),
    'type' => $page->category(),
    'footer' => [
      'affiliate-beautifier'
    ],
  );
};
1 Like