Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Blog and modules in home page?

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

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

Page: 1
Go to End
Author Topic: 1542 Views
  • knox
    Avatar
    Community Member
    4 Posts

    Blog and modules in home page? Link to this post

    Hi, i wish see the widgets (links, countdown, etc) in the home page but only can see after press the blog link.

    ?¿

    help me please

    thanks

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Blog and modules in home page? Link to this post

    You can have widgets on any page type by adding a WidgetArea to it. Open the page type code and add

    static $has_one = array(
       "MyWidgets" => "WidgetArea"
    );

    then in the getCMSFields you will need to add the widget drag and drop system

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

    Then last but not least you need to open up your template file and add the code to render the widget area. In this example you would need to put $MyWidgets in the template some where.

    Remember to db/build and then flush the page.

  • knox
    Avatar
    Community Member
    4 Posts

    Re: Blog and modules in home page? Link to this post

    Ok, but where is "page type"??

    explain me please

    thanks

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Blog and modules in home page? Link to this post

    Rather then explain and give you the full solution its probably better if you actually read tutorial 1 and 2 - http://doc.silverstripe.com/doku.php?id=tutorials and get to under stand the basics first, Tutorial 2 should cover what you need to know for this.

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