Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » how to start dev/build from cms after creation of a new Class (PageType)

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

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

Page: 1
Go to End
Author Topic: 1126 Views
  • Lukin
    Avatar
    Community Member
    42 Posts

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

    Hi,

    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

    Salut
    Lukin

  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

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

    If so then just type:

    http://[siteaddress]/dev/build/

  • SSadmin
    Avatar
    Community Member
    90 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

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

    [domain_name/dev/build]

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

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

  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

    Hi Lukin,

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

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

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

  • 3dgoo
    Avatar
    Community Member
    133 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

    Cool.

    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.

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: how to start dev/build from cms after creation of a new Class (PageType) Link to this post

    HI,

    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.

    Steps:

    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

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