Hi all,
I am trying to move content from an old CMS based in MSSQL to MODX. I have created a snippet that logs into the MSSQL DB and uses the data to create new objects in MODx. A sample of my code is below:
$object = $modx->newObject('modDocument');
$object->set('name', 'MyDocument');
$object->set('pagetitle', tidy($row['headline']));
$object->set('longtitle', tidy($row['headline']));
$object->set('description', tidy($row['summary']));
$object->set('introtext', tidy($row['summary']));
$object->set('parent', $containerID);
$object->set('alias', URLFriendlyFilename(tidy($row['headline'])));
$object->set('published', '1');
$object->set('publishedon', date('U', $row['posted']));
$object->set('richtext', '1');
$object->set('template', $templateID);
$object->set('menuindex', '0');
$object->set('searchable', '1');
$object->set('cacheable', '1');
$object->set('createdby', '1');
$object->set('createdon', date('U', $row['posted']));
$object->set('editedby', '1');
$object->set('editedon', date('U', $row['lastupdate']));
$object->set('uri', '');
$object->set('menuindex', $menuindex);
$object->setContent(tidy($row['article']));
// Save article
$object->save();
This SEEMS to work OK but I am finding that there are some problems. When I try and edit the pages in MODX the content (TinyMCE) areas are almost always blank. When I view the page (front-end) the content displays with some character encoding problems.
I'm not sure if this is related to character encoding?
Some of the old articles are plain text or very OLD HTML (<font> tags etc)
Do you have any thoughts on this?
Thanks,