PHP code example of symbiote / silverstripe-multisites

1. Go to this page and download the library: Download symbiote/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/ */

    

symbiote / 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);
	}
}