10931 Posts in 2614 Topics by 1810 members
|Go to End|
30 December 2008 at 5:21am Last edited: 30 December 2008 5:34am
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:
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:
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:
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!
30 December 2008 at 12:50pm
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 ;)
|Go to Top|