Render the content of subpages

The first solution is to use a plugin . This plugin allow you to pass the name of a page in parameter and display all the subpages.

url = "/"
title = "One page exemple"
layout = "default"


//php code block
<div class="container">
    {% component 'subpages' %}

Another solution that does not require a plugin is to use the RainLab\Pages\Classes\Page class. Don't forget to use a raw filter for the content of your page, because it contains HTML tags.

use RainLab\Pages\Classes\Page;

function onStart()
    $file = 'accueil-1.htm';
    $page = Page::find($file);
    $this['home1Title'] = $page->title;    
    $this['home1'] = $page->getProcessedMarkup();  
<div class="container">
            <h2>{{ home1Title }}</h2>
            {{ home1|raw }}

Posted in OctoberCMS on Sep 11, 2016