Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » default creating page in CMS

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

Page: 1
Go to End
Author Topic: 1744 Views
  • snaip
    Community Member
    180 Posts

    default creating page in CMS Link to this post

    is there any way that CMS will be creating another default pages like Home, Contact, AboutUs ??

    for example i create StuffPage and i want that the CMS will automatically add a new Page Type to my StuffPage

    - StuffPage
    -- new Page Type add by CMS

  • dospuntocero
    Community Member
    54 Posts

    Re: default creating page in CMS Link to this post

    off course you can, look how the blog module works:

        * Create default blog setup
       function requireDefaultRecords() {
          if(!DataObject::get_one('BlogHolder')) {
             $blogholder = new BlogHolder();
             $blogholder->Title = "Blog";
             $blogholder->URLSegment = "blog";
             $blogholder->Status = "Published";
             $widgetarea = new WidgetArea();
             $blogholder->SideBarID = $widgetarea->ID;
             $blogholder->publish("Stage", "Live");
             $managementwidget = new BlogManagementWidget();
             $managementwidget->ParentID = $widgetarea->ID;
             $tagcloudwidget = new TagCloudWidget();
             $tagcloudwidget->ParentID = $widgetarea->ID;
             $archivewidget = new ArchiveWidget();
             $archivewidget->ParentID = $widgetarea->ID;
             $blog = new BlogEntry();
             $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
             $blog->URLSegment = 'sample-blog-entry';
             $blog->setDate(date("Y-m-d H:i:s",time()));
             $blog->Tags = _t('BlogHolder.SUCTAGS',"silverstripe, blog");
             $blog->Content = _t('BlogHolder.SUCCONTENT',"Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in the CMS.");
             $blog->Status = "Published";
             $blog->ParentID = $blogholder->ID;
             $blog->publish("Stage", "Live");
             Database::alteration_message("Blog page created","created");

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.