Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Module custom page doesn't use any layout or template


Reply

2 Posts   217 Views

Avatar
mattdwen

24 January 2014 at 11:03am (Last edited: 24 January 2014 11:05am), Community Member, 12 Posts

I'm fairly new to SilverStripe, so please bear with the n00b :)

I've defined a custom page in a new module, which I can edit and view fine, but when viewing, it falls back to the default "Welcome to SilverStripe" template, and not the theme which is configured.

The page itself is totally vanilla:

<?php

   class PaymentForm extends Page {
   }

   class PaymentForm_Controller extends Controller {
   }

I've tried placing a PaymentForm.ss layout in /themes/themedir/templates/Layout which makes no difference.

I've also added the following function to PaymentForm_Controller which does render the page falling back to the Page.ss layout (which is what I ultimately want), but the page titles and nav are all missing.

public function index() {
return $this->renderWith(array('PaymentForm', 'Page'));
}

I would expect a custom page from a module to render using the standard Page.ss layout without any modification, so it feels like I'm missing something obvious.

I'm running 3.1.2.

Avatar
mattdwen

24 January 2014 at 11:38am Community Member, 12 Posts

Right, so ignore all that and make sure your controller extends Page_Controller.