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.

General Questions /

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

[Solved] Creating New Page Types: What Have I Missed


Reply


3 Posts   1314 Views

Avatar
Leesy

Community Member, 6 Posts

6 February 2009 at 12:27am

Edited: 06/02/2009 2:28am

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?

Avatar
Leesy

Community Member, 6 Posts

6 February 2009 at 2:28am

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

Avatar
Fuzz10

Community Member, 787 Posts

6 February 2009 at 9:31pm

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

"class TwoCoumnPage_Controller"

What did I win ? ;)