Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Builder module

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1070 Views
  • UncleCheese
    Avatar
    4085 Posts

    Builder module Link to this post

    Just something I came up with in about an hour just for fun. If you're anything like me, you find it tedious to create new PHP classes with the same structure and variables every single time you want a new page type. This Builder module allows you to do that from the URL like this:

    http://www.mysite.com/builder/MyNewClass/ParentClass/StartingTemplate

    Where "MyNewClass" is the name of the page type you want to create, "ParentClass" is just that -- usually Page, and "StartingTemplate" is the Layout you want to duplicate to get your template started. So in this example:

    http://www.mysite.com/builder/PortfolioPage/Page/Page

    You will get a new file PortfolioPage.php in your mysite/code folder with the model, getCMSFields(), and controller already built out for you to customize, and you'll also get a PortfolioPage.ss in your mysite/templates/Layout folder that is a clone of Page.ss, meant to be customized.

    Default values for the last two parameters are "Page." So the above can actually be achieved with this:

    http://www.mysite.com/builder/PortfolioPage

    Automatically redirects to a db/build.

    To set permissions, use Bulder::set_file_permissions($octet) in builder/_config.php. e.g. Builder::set_file_permissions(0755) (default value). $octet must be an integer.

    Anyway, I find this is a huge timesaver when I'm starting a project. Hopefully someone else will. Enjoy!

    Attached Files
  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Builder module Link to this post

    nice one uncle cheese, thats a great idea!

    As simple as it is it, it always seems like such a chore to make a new page type, especially when working online (when using aptanas ftp at least).

    SS development gets even easier ;)

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