PHP code example of thewebmen / silverstripe-staticpages

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

    

thewebmen / silverstripe-staticpages example snippets


public function generatestatic(){
    if($this->URLSegment == 'contact-us'){
        return false;
    }
    return true;
}

public function urlsAffectedByThisPage(){
    $children = SiteTree::get()->filter('ParentID', $this->ID);
    $urls = [];
    foreach($children as $child){
    $urls[] = $child->AbsoluteURL();
    }
    return $urls;
}



$staticpages_config = [
    'query_params' => ['start']
];