I am still learning SilverStripe, and right now, I have a list of 50-60 pages I have to create for a site. It was suggested that I find a way to auto-populate the SilverStripe site tree with some code in order to save time (as opposed to manually creating each page one at a time). I have never tried something like this before (with or without a CMS). I know what the parent and child page names are, and I suppose I would need to create a loop to build out the child pages for each parent.
Is this something that is possible in SilverStripe? Would a for loop be the best approach or is there a more efficient way? If I can make creating these pages easier, it would be great for me for this project and future ones, so any advice would be appreciated!
My understanding of this question is that you want to pre-populate the pages and their content programmatically rather than manually entering them in the CMS. There are a few projects that might help you.
Or you could simply override DataObject::requireDefaultRecords and build the pages out there. I would often use that method for functional or one-off type pages (e.g. ShoppingCart).
There is also a Site Tree Importer from SilverStrip Labs. It's hosted on Github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With