adding page by code in 5.7
Permalink 2 users found helpful
i have:
i am geting an error with CollectionType:: i think CollectionType:: is not used in 5.7 what is the alternative?
$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?
What is the error message you are getting?
Class 'CollectionType' not found
i did a lot of digging around and finally got it.
use Concrete\Core\Page\Type\Type; $collectionType = Type::getByHandle('releases');
Thanks a lot, I helped me as well.
I also had the same issue.
But have an additional question: how can I also add Content or HTML to the same Page?
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?