code/SiteTreeSubsites.php
/**
	 * Create a duplicate of this page and save it to another subsite
	 * @param $subsiteID int|Subsite The Subsite to copy to, or its ID
	 * @param $isTemplate boolean If this is true, then the current page will be treated as the template, and MasterPageID will be set
	 */
Create a duplicate of this page and save it to another subsite
@param $subsiteID int|Subsite The Subsite to copy to, or its ID
@param $isTemplate boolean If this is true, then the current page will be treated as the template, and MasterPageID will be set
Create a duplicate of this page and save it to another subsite @param $subsiteID int|Subsite The Subsite to copy to or its ID @param $isTemplate boolean If this is true then the current page will be treated as the template and MasterPageID will be set
public function duplicateToSubsite($subsiteID = null, $isTemplate = true) {
		if(is_object($subsiteID)) {
			$subsite = $subsiteID;
			$subsiteID = $subsite->ID;
		} else $subsite = DataObject::get_by_id('Subsite', $subsiteID);
		$page = $this->owner->duplicate(false);
		$page->CheckedPublicationDifferences = $page->AddedToStage = true;
		$subsiteID = ($subsiteID ? $subsiteID : Subsite::currentSubsiteID());
		$page->SubsiteID = $subsiteID;
		if($isTemplate) $page->MasterPageID = $this->owner->ID;
		$page->write();
		return $page;
	}
public function duplicateToSubsite ( $ subsiteID = null , $ isTemplate = true ) { if ( is_object ( $ subsiteID ) ) { $ subsite = $ subsiteID ; $ subsiteID = $ subsite -> ID ; } else $ subsite = DataObject :: get_by_id ( 'Subsite' , $ subsiteID ) ; $ page = $ this -> owner -> duplicate ( false ) ; $ page -> CheckedPublicationDifferences = $ page -> AddedToStage = true ; $ subsiteID = ( $ subsiteID ? $ subsiteID : Subsite :: currentSubsiteID ( ) ) ; $ page -> SubsiteID = $ subsiteID ; if ( $ isTemplate ) $ page -> MasterPageID = $ this -> owner -> ID ; $ page -> write ( ) ; return $ page ; }
Create a duplicate of this page and save it to another subsite
 @param $subsiteID int|Subsite The Subsite to copy to, or its ID
 @param $isTemplate boolean If this is true, then the current page will be treated as the template, and MasterPageID will be set
Create a duplicate of this page and save it to another subsite @param $subsiteID int|Subsite The Subsite to copy to or its ID @param $isTemplate boolean If this is true then the current page will be treated as the template and MasterPageID will be set