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.

Customising the CMS /

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

Generate Webpages

Go to End

4 Posts   675 Views


Community Member, 1 Post

19 September 2013 at 9:58pm


I'm wondering if it's possible to mass generate webpages somehow.

I want to be able to generate a lot of empty webpages with the help of a script.

I am very new to this, can someone help me with a basic example of how this would be done?



Forum Moderator, 5523 Posts

20 September 2013 at 6:21pm

You can generate pages on your site through PHP directly

$page = new Page();
$page->Title = "My Page";
$page->write(); // save the page

// publish it from draft to live
$page->doPublish('stage', 'live');


Community Member, 1 Post

27 September 2013 at 12:45am

Sorry if I use this thread to ask, but where would I put that PHP code to be able to generate the pages and make them appear in the sitetree?



Forum Moderator, 5523 Posts

27 September 2013 at 8:36pm

Well it depends on where and what context you want to generate the page. Are you running a database migration from an existing system and therefore should encapsulate the code into a BuildTask [1], or perhaps you need to create a page by default (say always create 1 homepage object) then you'd put that code in a requireDefaultRecords call [2] which gets run when the user runs dev/build.

[2] (example