Copy pages

Hi,

Does anyone have a recommendation for copying existing pages from one
parent to
another?

I’m doing it against the database directly (sql, export, import), but
I’m hoping
for a more efficient way.

Todd

Todd,

Do you want to copy them or just move them? Moving them is fairly
trivial with script/console.

Sean

Hi Sean,

I need to copy em

BTW- radiantcms.com is down?

Todd

Quoting Sean C. [email protected]:

On Feb 26, 2007, at 2:08 PM, Todd McGrath wrote:

BTW- radiantcms.com is down?

yes, it’s not just you.

Todd,

Yes, I asked John about it, and TextDrive is having issues with the
server. (radiantcms.org)

There’s not a trivial way to do a deep-copy of a page, but I’ll outline
the process for you.

  1. Open script/console production (assuming you’re running in production
    mode-- I hope)
  2. Use Page.find to get the original page that you intend to copy.
  3. Clone the original page (original.clone).
  4. Assign the parent or parent_id of the cloned page.
  5. Iterate through all the page parts of the original page, clone them,
    and add them as parts to the cloned page.
  6. Save everything.

Sean

Todd McGrath wrote:

BTW- radiantcms.com is down?

It’s back up now.


John L.
http://wiseheartdesign.com