I recently found myself wanting to add a page in a piece of code and it took me a few attempts to get it working, so here is how I eventually figured it out.

You’ll need the parent page and the type of page, though this is actually referred to internally as a CollectionType.

$ct = CollectionType::getByHandle('full');<br></br>
$parent = Page::getByPath('/blah');<br></br>
if (is_object($ct) && is_object($parent)) {<br></br>
    $data = array('cName' => 'New Page');<br></br>
    $np = $parent->add($ct, $data);<br></br>

In the above example I’ve only set the name of the page but there are other pieces of information that can be set as well. Each page has an internal handle that is used as part of the path and by only setting the name this will be generated using the name (it will also be unique).