7

I tried to build tabs with jquery. But i recognized that my links

<a href="#tab-1">Tab 1</a>

are converted to

<a href="/#tab-1">Tab 1</a>

Because of the Slash at the beginning the tabs doesn't work. Why is Silverstripe modifiying my anchor links and how can I stop it from doeing this??

invictus
  • 825
  • 1
  • 9
  • 33

2 Answers2

6

On 2.4er setup I set in _config.php

SSViewer::setOption('rewriteHashlinks', false);

not tested with 3.x and the yml config layer

munomono
  • 1,243
  • 9
  • 19
  • can you try, make it work the yml-way? somth like this (no tabs just space in /mysite/_config/config.yml) SSViewer: setOption: rewriteHashlinks: true – munomono Dec 13 '13 at 10:01
  • if i copy paste it, it doesn't work. edit: doesn't matter which constellation I try. It doesn't work :/ can you tell me the advantages of using the yml file instead of config.php? – invictus Dec 13 '13 at 10:10
  • 1
    YML config are cached and so will give you a performance inscrease. Also, some of the old notation will most likely be depracated soon. Try this in your YML SSViewer.rewrite_hashlinks: false (Replacing the '.' with a new line and 2 spaces indentation, like for theme) – colymba Dec 13 '13 at 10:41
  • i tried this before. doesn't work. thank you for the explanation. Is there a guide or something like this where i could look up how to convert my _config.php configurations to a yml? – invictus Dec 13 '13 at 11:54
  • did you ?flush the cache after updating the yml? Check the changelog http://doc.silverstripe.org/framework/en/3.1/changelogs/3.1.0#static-properties-are-immutable-and-private-you-must-use-config-api there is all you need there – colymba Dec 13 '13 at 13:18
  • still did not try myself but this guy says: SSViewer: rewrite_hash_links: false https://github.com/redema/silverstripe-patchwork/blob/master/_config/patchwork.yml – munomono Dec 17 '13 at 21:54
4

SSViewer::setOption() is deprecated in 3.2

Use one of the following examples to set rewrite_hash_links

config.yml

SSViewer:
  rewrite_hash_links: false

_config.php

Config::inst()->update('SSViewer', 'rewrite_hash_links', false);

(http://api.silverstripe.org/3.1/class-SSViewer.html#_setOption)

eamon
  • 51
  • 4