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:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

how to start dev/build from cms after creation of a new Class (PageType)

Go to End

8 Posts   1462 Views


Community Member, 56 Posts

21 March 2011 at 9:10am


I'm creating new Classes (PageTypes) in the cms and want to rebuild the db after saving the new class to mysite/code to
publish the new class.
The Classname-Field of the SiteTree-Tables needs to be updated to add the new PageType-Class

I foud DB::beginSchemaUpdate() but I dont know if it does the right action and if yes, how to do it ??

THanks in advance for any advice



Community Member, 135 Posts

21 March 2011 at 1:36pm

Don't you just want to do a dev/build?

If so then just type:



Community Member, 90 Posts

21 March 2011 at 2:40pm

yeah.. Like ampedup said..
Try the default silverstripe db re-build url.



Community Member, 56 Posts

21 March 2011 at 11:52pm

hi again,..
I'm creating the classes on the fly in one of my onAfterWrite-Events in ModelAdmin and need
to update SiteTree /live/version without typing any url. It has to happen in the background...


Community Member, 135 Posts

22 March 2011 at 12:48am

Hi Lukin,

Why do you want to create classes on the fly from the CMS?


Community Member, 56 Posts

22 March 2011 at 1:17am

well :)

I'm building some kind of catalogue which is organized in serveral categories an subcategories. These categories are managed in a modeladmin. The catalogue itself is managed in the Pages - sitetree, like normal pages. Now if the user adds a new category in modeladmin, I need to create a pagetype (pagetype-class) wich represents the new category in sitetree... Although I'm creating a new ss-template for each category...
This might be a bit complicate but seems to be the most userfriendly solution for my needs, ...


Community Member, 135 Posts

22 March 2011 at 11:23am


I would have the categories as just a field in your page. Looking at your description there are going to be no structural differences between the pages that have different categories. In that case there is no need to create new page types. Just have a dropdown to select which category the object is. This dropdown can still be generated from a list you create in modeladmin.

I don't think it's possible to create new page types on the fly like this. To the best of my knowledge, you need to physically write the php code to define the classes you want.


Community Member, 56 Posts

22 March 2011 at 12:45pm

Edited: 22/03/2011 1:08pm


well, there are some differences,.. subcat of cat musn't show all pages of cat and sub1 of cat has diffrent pages than sub2 of cat...
subsub extends sub extends cat....

I thought about the dropdownsolution aswell, but I want to do it autmoatic, so the user doesn't have to configure which type of pages he needs to create.


1. Creating new Categroy in ModelAdmin ... onAfterWrite:
2. Writing new Class-File with the name of the new category to mysite/code
3. [unsolved] Rebuilding database or better only rebuilding the sitetree-tables
4. Creating new Page with my new PageType into SiteTree

With the target to get these dataobject 'multilevel-structure' displayed as pages( and subpages, or categories/subcategories) in SiteTree

hope you got me....

I'm not very familiar to write in english :)