Creating a Blog Entry programmatically
Permalink
Hi,
I am using Concrete 5.7 and would like to create a blog entry programmatically.
This part works ... I have problems adding Content and thumbnail.
I am using Concrete 5.7 and would like to create a blog entry programmatically.
$pagetype = PageType::getByID(6); $pt = $pagetype->getPageTypeDefaultPageTemplateObject(); $page = $pagetype->createDraft($pt); $pData = array('cName' => 'An automatic Blog Entry name'); $page->update($pData);
This part works ... I have problems adding Content and thumbnail.
So you need to fetch the relevant Area and add a new Content block to it, then update the Content block actual content.
As for the thumbnail, not sure, it used to be an image block in the "Thumbnail" area, but since there is now a "thumbnail" image attribute maybe the blog entry page list template can fetch it from here. You should check the template code for more info.