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.

Template Questions /

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

KEEPS GIVING ME THE SAME ERROR >< !!


Go to End


3 Posts   1875 Views

Avatar
Marksten

Community Member, 2 Posts

20 January 2009 at 6:01am

Edited: 20/01/2009 6:05am

Hey Dudes,

Im kinda frustrated, because I made a template and I can't seem to get it right. SS keeps giving me the same error, over and over again. I've tried several "how to make a template" tutorials, and I've spoken to some dudes. But nothin' seems to work.

Ok, I wanted to have a template with 2 columns (left and right). So I made a template with the following code:

<?php

class HomePage extends SiteTree
{
static $db = array(
'mySubContent' => 'HTMLText'
);

static $defaults = array(
);

function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField ( $name = "mySubContent", $title = "Sub Content" ), 'Content' );
return $fields;
}

}

?>

I saved it in the code map, and after I flushed the db I really could select it. I was a happy man, until I looked at my homepage:

LINK TO MY WEBSITE: http://www.marksten.nl/blog/

Somebody, help this suicidal man :p

Avatar
UncleCheese

Forum Moderator, 4102 Posts

20 January 2009 at 6:37am

Looks like you don't have a Controller set up.

First, make sure HomePage extends Page.

Second, add

class HomePage_Controller extends Page_Controller
{
}

below your HomePage class.

Avatar
Marksten

Community Member, 2 Posts

20 January 2009 at 6:55am

Thanks, it worked! :)