Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

17478 Posts in 4473 Topics by 1972 members

Archive

SilverStripe Forums » Archive » Multiple Widget Areas

Our old forums are still available as a read-only archive.

Page: 1
Go to End
Author Topic: Multiple Widget Areas 1849 Views
  • marks
    avatar
    2 posts

    Multiple Widget Areas Link to this post

    Dear All,

    We are using a three column layout and would like to set-up two widget areas - one for the left column, and one for the right.

    Everything works well with one widget area but as soon as I add a second widget area to the page it stops working in the admin area. It looks like the problem is that the Javascript uses an ID to locate the widget area and if you have two areas it breaks.

    Does anyone know if its possible to have two widget areas on the same page?

    Thanks in advance.

    Mark

  • MIke
    avatar
    Community Member
    7 posts

    Re: Multiple Widget Areas Link to this post

    Same Issue, could we make two class Widget aera 1 and 2 ?

  • simon_w
    avatar
    Community Member
    231 posts

    Re: Multiple Widget Areas Link to this post

    Do they have different names?

  • Willr
    avatar
    Moderator
    2744 posts

    Re: Multiple Widget Areas Link to this post

    Im pretty sure 2 widget areas will work. Following the example on the widgets page in the docs you would have 2 widgetareas defined (eg LeftSideWidgets, RightSideWidgets) instead of 1.

  • MIke
    avatar
    Community Member
    7 posts

    Re: Multiple Widget Areas Link to this post

    Hi,

    I tryed yesterday many way to use two widget aera on a left sidebar
    and a right sidebar. I tried 3 approach . And at each time the admin section was not working properly.
    I was not able to drag Widget from the WidgetAeraEditor_availableWidget form the right side bar.

    /*---------------------------------------------*/
    /*----------- 1st approach -------------*/

    Just to create in a page.php a second widget

    class Page extends SiteTree {
       static $db = array(
       
       );
       static $has_one = array(
       "leftSidebar" => "WidgetArea",
       "RightSidebar" => "WidgetArea"
    );

    function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->addFieldToTab("Root.Content.SideBar", new WidgetAreaEditor("leftSidebar"));
       $fields->addFieldToTab("Root.Content.SideBar", new WidgetAreaEditor("RightSidebar"));
       return $fields;
    }

    }

    /*-------- Result -----------*/
    -> i ran db/build?flush=1
    -> /admin and I am able to manage only the section of left
    and it appear (after saving and refresh) the same widget value in both WidgetAreaEditor_usedWidgets and delete work only in the left (first) one

    /*---------------------------------------------*/
    /*----------- 2nd approach -------------*/

    Just to create in a page.php a second widget but manage in a second tab

    class Page extends SiteTree {
       static $db = array(
       
       );
       static $has_one = array(
       "leftSidebar" => "WidgetArea",
       "RightSidebar" => "WidgetArea"
    );

    function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->addFieldToTab("Root.Content.LeftSideBar", new WidgetAreaEditor("leftSidebar"));
       $fields->addFieldToTab("Root.Content.RightSideBar", new WidgetAreaEditor("RightSidebar"));
       return $fields;
    }

    }

    /*-------- Result -----------*/
    -> i ran db/build?flush=1
    -> admin and I am able to manage only the section of LeftSideBar and nothing move in WidgetAreaEditor_availableWidgets in the RightSideBar tab

    /*---------------------------------------------*/
    /*----------- 3rd approach -------------*/

    stupid approach crate a new class RightWidgetArea in C:\....\lighttpd\htdocs\sapphire\widgets

    <?php

    class RightWidgetArea extends DataObject {
       static $db = array();
       
       static $has_many = array(
          "Widgets" => "Widget"
       );
       
       function forTemplate() {
          return $this->renderWith("WidgetArea");
       }
    }

    ?>

    and then

    class Page extends SiteTree {
       static $db = array(
       
       );
       static $has_one = array(
       "leftSidebar" => "WidgetArea",
       "RightSidebar" => "RightWidgetArea "
    );

    function getCMSFields() {
       $fields = parent::getCMSFields();
       $fields->addFieldToTab("Root.Content.LeftSideBar", new WidgetAreaEditor("leftSidebar"));
       $fields->addFieldToTab("Root.Content.RightSideBar", new WidgetAreaEditor("RightSidebar"));
       return $fields;
    }

    }

    /*-------- Result -----------*/
    (same has the 2nd approach)

    -> i ran db/build?flush=1
    -> admin and I am able to manage only the section of LeftSideBar and nothing move in WidgetAreaEditor_availableWidgets in the RightSideBar tab

    /*--- Please help me ---*/

    I will finish by hardcode and rendering manualy the widget of the right side bar..
    But i am sure some one already succes to manage 2 section of widget on one page, doesn't you ?
    So any idea is more than welcome

    have a good one
    MIke

    10 types of people , developers and .. others

  • MIke
    avatar
    Community Member
    7 posts

    Re: Multiple Widget Areas Link to this post

    Ok, i know my previous msg was a little too long but to resume , no you can not administer 2 widget aera for the moment.. or for me something is missing..
    Do you have any idea how to do this ?

  • oc
    avatar
    Community Member
    3 posts
    1849 Views
Page: 1
Go to Top

Currently Online: Euphemismus, fearofbuttons

Welcome to our latest member: fearofbuttons

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.