Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

external links


Reply


6 Posts   1969 Views

Avatar
penny

3 Posts

16 July 2007 at 3:37pm

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!

Avatar
Sigurd

Forum Moderator, 628 Posts

16 July 2007 at 3:58pm

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 ...

Avatar
penny

3 Posts

16 July 2007 at 5:14pm

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.. :/

Avatar
Willr

Forum Moderator, 5513 Posts

16 July 2007 at 9:00pm

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 :P so you might want to try hard coding the link in the template if you have to after the end_control for the menu.

Avatar
Sam

Administrator, 685 Posts

16 July 2007 at 9:02pm

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.

Avatar
penny

3 Posts

17 July 2007 at 4:14pm

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.