Jump to:

23358 Posts in 17875 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » [Solved] Creating New Page Types: What Have I Missed

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1260 Views
  • Leesy
    Avatar
    Community Member
    6 Posts

    [Solved] Creating New Page Types: What Have I Missed Link to this post

    Hi all,

    I've attempted to create a new page type in SilverStripe version 2.3.0 rc2/rc3 but am not having much luck getting it to display in the front end. I think the same code was working in v2.2.3 but I retyped it by hand. Could anyone look at what I did and let me know if I missed anything.

    The following is the code that I created in mysite/code/TwoColumnPage.php:

    <?php

    class TwoColumnPage extends Page {

    public static $db = array(
    'SidebarContent' => 'HtmlText'
    );

    public static $has_one = array();

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('SidebarContent', 'Sidebar Content'));
    return $fields;
    }
    }

    class TwoCoumnPage_Controller extends Page_Controller {
    }

    ?>

    Following this I did the usual DB build and my pages appear in the admin section. So I've tried to create a page but when I try and view this website in the webpage, all I get is a HTML page saying "TwoColumnPage". In RC2 this appeared to be a HTML page (there were html, head & body tags in the source) but in RC3 it's just the text "TwoColumnPage".

    I've also tried creating themes\mytheme\templates\Layout\TwoColumnPage.ss but that's not helping at all.

    Has anyone else had this problem? Could it be a bug in the new release candidates (can't see anything in the bug tracker)? Or am I missing something simple?

  • Leesy
    Avatar
    Community Member
    6 Posts

    Re: [Solved] Creating New Page Types: What Have I Missed Link to this post

    Groan... This is what happens when you stare at a bit of code for too long. Spot the spelling mistake in the controller

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: [Solved] Creating New Page Types: What Have I Missed Link to this post

    hehehehe...I know exactly what you mean ...

    "class TwoCoumnPage_Controller"

    What did I win ? ;)

    1260 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.