Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » external links

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1934 Views
  • penny
    Avatar
    3 Posts

    external links Link to this post

    I'm wondering whether there's an easy way to add a target="_blank" to an item that's part of the menu generated by SS?

    I'm working on a site that requires an external forum, and as far as I can see the only option is to add a page called "Forum" and make that page redirect to the forum. Still, the link is part of the main menu, and the content editor doesn't let me edit anything except for the actual URL.

    Maybe this is covered somewhere in the tutorials, but I can't seem to find it..

    Thanks for any pointers!

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: external links Link to this post

    At the moment the insert-link interface doesn't allow opening in new page (if you really want, you can go an read up about XHTML 1.1 since there is a strong philosophy behind the idea that _blank is a bad idea).

    The 'demo' link on silverstripe.com's main menu just uses a Redirecting Page to go to demo.silverstripe.com ...

  • penny
    Avatar
    3 Posts

    Re: external links Link to this post

    Thanks for the quick reply!

    I wish I could do everything according to brave new webstandards, but in this case it's the client who gets to call the shots.. :/

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: external links Link to this post

    you could try this solution rather then _blank http://weblogtoolscollection.com/archives/2004/01/02/targetblank-xhtml-10-strict-conversion/

    but you still need someway to add a rel tag to a link so you might want to try hard coding the link in the template if you have to after the end_control for the menu.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: external links Link to this post

    Do do this, create a checkbox field such as OpenInNewWindow on your Page class.

    then, edit the menu in the template to have something like
    [html]
    <a href="$Link" <% if OpenInNewWindow %>target="_blank"<% end_if %> >$MenuTitle</a>
    [/html]

    See the tutorials for more info.

  • penny
    Avatar
    3 Posts

    Re: external links Link to this post

    cheers guys, your help is very much appreciated.

    btw: the client has now decided to drop the forum altogether. i'll go and bang my head against a wall for a little while

    also: SS rocks, keep up the good work.

    1934 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.