Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » KEEPS GIVING ME THE SAME ERROR >< !!

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

Page: 1
Go to End
Author Topic: 893 Views
  • Marksten
    Avatar
    Community Member
    2 Posts

    KEEPS GIVING ME THE SAME ERROR >< !! Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: KEEPS GIVING ME THE SAME ERROR >< !! Link to this post

    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.

  • Marksten
    Avatar
    Community Member
    2 Posts

    Re: KEEPS GIVING ME THE SAME ERROR >< !! Link to this post

    Thanks, it worked!

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