Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Module custom page doesn't use any layout or template

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

Page: 1
Go to End
Author Topic: 189 Views
  • mattdwen
    Avatar
    Community Member
    12 Posts

    Module custom page doesn't use any layout or template Link to this post

    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.

  • mattdwen
    Avatar
    Community Member
    12 Posts

    Re: Module custom page doesn't use any layout or template Link to this post

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

    189 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.