Jump to:

23473 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » How to create a full homepages as demo

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: 483 Views
  • makensy13
    Community Member
    2 Posts

    How to create a full homepages as demo Link to this post


    My question is:

    How to create homepages (as in the demo):

    - Content
    - Left box text
    - Left Image
    - Middle text box
    - Middle Image
    - Right text box
    - Image Right

    Thank you again


  • Willr
    Forum Moderator
    5497 Posts

    Re: How to create a full homepages as demo Link to this post

    Have a read of tutorial 2. This covers how to add fields to pages. In the case of the demo it looks something like

    class HomePage extends Page {
       static $db = array(
          "LeftBoxTxt" => "HTMLText",
          "MiddleBoxTxt" => "HTMLText",      
          "RightBoxTxt" => "HTMLText"

       static $has_one = array(
          'LeftBoxImg' => 'Image',
          'MiddleBoxImg' => 'Image',
          'RightBoxImg' => 'Image'
       function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("LeftBoxTxt","Left box text"));
          $fields->addFieldToTab("Root.Content.Main", new ImageField('LeftBoxImg', 'Left Image'));
          $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('MiddleBoxTxt','Middle box text'));
          $fields->addFieldToTab("Root.Content.Main", new ImageField('MiddleBoxImg', 'Middle Image'));
          $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('RightBoxTxt','Right box text'));
          $fields->addFieldToTab("Root.Content.Main", new ImageField('RightBoxImg', 'Right Image'));
          return $fields;

    class HomePage_Controller extends Page_Controller {


    But I recommend reading the 2nd SilverStripe tutorial (http://doc.silverstripe.org/sapphire/en/tutorials/2-extending-a-basic-site) to get to grips with what that code does.

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.