Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Covert DataObject to page

Go to End

2 Posts   1280 Views


Community Member, 12 Posts

15 January 2010 at 6:52am

I was wondering if it is possible to import the data from a dataobject and change it to a page?

My client decided that they wanted a full page as opposed to a javascript pop up for each of their products.

Is there an easy way to do this, or do I need to re-enter everything?

Any advice is appreciated!


Forum Moderator, 5523 Posts

15 January 2010 at 12:15pm

It would be pretty trivial to write a little migration task which did something like

// mysite/code/PageMigrationTask

class PageMigrationTask extends MigrationTask {

function run() {

// go through each object making a new page
$objects = DataObject::get('MyObject');
foreach($objects as $object) {

$page = new Page();
$page->Title = $object->Title;
$page->ParentID = $ID of page you want these to be under
$page->publish('Stage', 'Live');

Then you can run the migration task when you want by going