page_type getMasterTemplate() error
Permalink
Hello, I'm trying to auto-add a page from a form post on a single page (?p=PageName) and having some issues. I can add the page just fine, and apply the logged in user as the owner, but the page's advanced permissions is applying from the hierarchy instead of the Dashboard page_type defaults. My code is as follows:
My issue now is that the error "Call to a member function getMasterTemplate() on a non-object in..."
Any suggestions?
$pr = Page::getByPath('/'.$u->getUsername()); $data = array(); $data['cName'] = $_REQUEST['p']; $data['uID'] = $u->getUserID(); $data['exclude_nav'] = '1'; $data['cDescription'] = $_REQUEST['p']; $data['cDatePublic'] = 'fdt_date_on'; $ct = CollectionType::getByHandle('mobile'); $newPage = $pr->add($ct, $data); $nh = Loader::helper('navigation'); $newPagePath = $nh->getCollectionURL($newPage); $newPageID = $newPage->getCollectionID(); $ct = CollectionType::getByID($newPageID); $masterC = $ct->getMasterTemplate(); $db = Loader::db();
Viewing 15 lines of 16 lines. View entire code block.
My issue now is that the error "Call to a member function getMasterTemplate() on a non-object in..."
Any suggestions?