PHP code example of sheadawson / silverstripe-multisites

1. Go to this page and download the library: Download sheadawson/silverstripe-multisites library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sheadawson / silverstripe-multisites example snippets


$fields->fieldByName('Root.Main.Image')->setFolderName('images/page-images')->useMultisitesFolder();

/**
 * Overrides SiteTree->Link. Adds a check for cases where we are linking to a
   page on a
 * different site in this multisites instance.
 * @return String
 **/
public function Link($action = null) {
	if($this->SiteID && $this->SiteID == Multisites::inst()->getCurrentSiteId()) {
		return parent::Link($action);
	} else {
		return $this->RelativeLink($action);
	}
}