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 ??
22 March 2011 at 1:17am
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, ...
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.
22 March 2011 at 12:45pm
(Last edited: 22 March 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