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.

All other Modules

Discuss all other Modules here.

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

Builder module


Reply

2 Posts   1091 Views

Avatar
UncleCheese

30 December 2008 at 5:21am (Last edited: 30 December 2008 5:34am), 4085 Posts

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
Avatar
Carbon Crayon

30 December 2008 at 12:50pm Community Member, 598 Posts

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