mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 20:59:23 +02:00
Merge pull request #8928 from DorsetDigital/patch-4
Update 03_Disable_Anchor_Links.md
This commit is contained in:
commit
45edc816ba
@ -37,17 +37,20 @@ SilverStripe\View\SSViewer:
|
|||||||
rewrite_hash_links: false
|
rewrite_hash_links: false
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, a better way is to call this just for the rendering phase of this particular file:
|
Alternatively, it's possible to disable anchor link rewriting for specific pages using the `SSViewer::setRewriteHashLinksDefault()` method in the page controller:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
namespace Example\HashLink;
|
||||||
|
|
||||||
|
use PageController;
|
||||||
use SilverStripe\View\SSViewer;
|
use SilverStripe\View\SSViewer;
|
||||||
|
|
||||||
public function RenderCustomTemplate()
|
class ExamplePageController extends PageController
|
||||||
{
|
{
|
||||||
SSViewer::setRewriteHashLinks(false);
|
protected function init()
|
||||||
$html = $this->renderWith('My/Namespace/MyCustomTemplate');
|
{
|
||||||
SSViewer::setRewriteHashLinks(true);
|
parent::init();
|
||||||
|
SSViewer::setRewriteHashLinksDefault(false);
|
||||||
return $html;
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user