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

mutliple textareas on each page


Reply


3 Posts   925 Views

Avatar
bit99

Community Member, 24 Posts

6 July 2010 at 3:24pm

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,

Avatar
Willr

Forum Moderator, 5513 Posts

6 July 2010 at 6:16pm

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.

Avatar
bit99

Community Member, 24 Posts

6 July 2010 at 6:23pm

thanks Willr!
thats great,