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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

default creating page in CMS

Go to End

2 Posts   2316 Views


Community Member, 181 Posts

13 March 2009 at 10:09am

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


Community Member, 54 Posts

13 March 2009 at 12:32pm

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");