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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Module custom page doesn't use any layout or template


Go to End


2 Posts   856 Views

Avatar
mattdwen

Community Member, 12 Posts

24 January 2014 at 11:03am

Edited: 24/01/2014 11:05am

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

Community Member, 12 Posts

24 January 2014 at 11:38am

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