PHP code example of fromholdio / silverstripe-urlsegmenter
1. Go to this page and download the library: Download fromholdio/silverstripe-urlsegmenter 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/ */
fromholdio / silverstripe-urlsegmenter example snippets
class Widget extends DataObject
{
// or apply via config.yml
private static $extensions = [
URLSegmenter::class
];
private static $db = [
'Title' => 'Varchar'
];
private static $has_one = [
'WidgetCategory' => WidgetCategory::class
];
public function getURLSegmenterScope()
{
return self::get()
->filter('WidgetCategoryID' => $this->WidgetCategoryID)
->exclude('ID', $this->ID);
}
}