PHP code example of innoweb / silverstripe-remove-trailing-slash
1. Go to this page and download the library: Download innoweb/silverstripe-remove-trailing-slash 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/ */
innoweb / silverstripe-remove-trailing-slash example snippets
/**
* Remove trailing slash from page links. SiteTree forces a trailing slash if no action is set, which doesn't
* make sense, really. Every other functionality in SS doesn't add the trailing slash, e.g. in HTTP and
* HTTPRequest classes.
*
* @see \SilverStripe\CMS\Model\SiteTree::RelativeLink()
*/
public function RelativeLink($action = null)
{
$link = parent::RelativeLink($action);
$link = rtrim($link, '/');
return $link;
}