adding page by code in 5.7

Permalink 2 users found helpful
i have:
$page = Page::getByID(146);
$collectionType = CollectionType::getByHandle('artical');
$pageData = array();
$pageData['cName'] = 'Page Name';
$pageData['cDescription'] = 'Page Description';
$newPage = $page->add('artical', $pageData);
$this->redirect('/dashboard/articles/releases');


i am geting an error with CollectionType:: i think CollectionType:: is not used in 5.7 what is the alternative?

View Replies: View Best Answer
AndyJ replied on at Permalink Reply
What is the error message you are getting?
aryeh replied on at Permalink Reply
Class 'CollectionType' not found
aryeh replied on at Permalink Best Answer Reply
i did a lot of digging around and finally got it.
use Concrete\Core\Page\Type\Type;
$collectionType = Type::getByHandle('releases');
imissi replied on at Permalink Reply
Thanks a lot, I helped me as well.
balavec replied on at Permalink Reply
I also had the same issue.

use \Concrete\Core\Page\Type\Type as CollectionType;

But have an additional question: how can I also add Content or HTML to the same Page?