Jump to content

Alex Parra

Members
  • Posts

    6
  • Joined

  • Last visited

Community Answers

  1. Alex Parra's post in render a partial with $otherPage->render was marked as the answer   
    Ah! That looks much better... complete code below
    /** * site/config.php */ $config->appendTemplateFile = '_layout.php'; /** * site/templates/home.php */ $title = $page->title; $shop = $pages->get('/shops/mr-big'); $mainContent = $shop->render('partials/shop-intro.php', ['appendFile'=>null]); /** * site/templates/partials/shop-intro.php */ <div class="shop-intro"> <h2><?= $page->title ?></h2> <?php foreach( $page->shop_photos AS $photo ) : ?>   <img src="<?= $photo->url ?>" /><br/> <?php endforeach; ?> <div class="shop-desc">   <?= html_entity_decode($page->shop_description) ?> </div> </div> /** * site/templates/_layout.php */ <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?= $title; ?></title> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body> <h1><?= $title; ?></h1> <div class="container"> <?= $mainContent ?> </div> </body> </html>   I like it like this...
    If anyone has a better way, feel free to jump in.
×
×
  • Create New...