Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » mutliple textareas on each page

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: 868 Views
  • bit99
    Avatar
    Community Member
    24 Posts

    mutliple textareas on each page Link to this post

    Hi,

    I am new to silverstripe,
    just downloaded, went through a tutorial and setup my first silverstripe site, and I really like the simplicity of silverstripe

    what I am wondering is:
    How do I setup more than one editable textfield on a page? or is it possible? the tutorials (that I have seen) seem to only deal with one editable region.
    my first layout/template has 3 columns and it would be great to have left nav and two editable separate textfields ,

    also, styling a css javascript dropdown menu to work with silverstripe, are there any good tutorials or faq on this?

    thanks,

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: mutliple textareas on each page Link to this post

    Course you can have multiple textareas!. Each text area needs to be made a unique database fields and then a form field added to the CMS. In your case (sidebars) I think you would want to make them HTML Areas rather than plain text.

    First step is add the fields to the database. Edit your $db array to something like this.. (tutorial 2 gives you an introduction to this)

    static $db = array(
          "LeftBoxTxt" => "HTMLText",   
          "RightBoxTxt" => "HTMLText"
    );

    Second step is to add it the CMS (again this is covered in depth in tutorial 2)

       function getCMSFields() {
          $fields = parent::getCMSFields();
          
          $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("LeftBoxTxt","Left box text"));   
          $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField('RightBoxTxt','Right box text'));
          
          return $fields;
       }

    After doing that rebuild your database (by visiting yoursite.com/dev/build) and now you should have 2 more editor fields in the cms which you can call in your template.

  • bit99
    Avatar
    Community Member
    24 Posts

    Re: mutliple textareas on each page Link to this post

    thanks Willr!
    thats great,

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