Recent Topics

1 Jun 15, 2010 00:12    

My b2evolution Version: [3.3.3]

I'm using the widget for sidebar links, and I enter the link in "Link to URL", but I want the link to open in a new window. However, it looks like the HTML or PHP for the URL is handled elsewhere.

Anyone know where I can set this?

2 Jun 15, 2010 01:38

It's easier to make all external links open in new window.

Add this code at the top of skins/yourskin/index.main.php

add_js_headline('
jQuery(function(){
	// Open external links in new window/tab
	jQuery("a[href^=\'http:\']").not("[href*=\'" + window.location.host + "\']").attr("target", "_blank");
});
');

3 Jun 15, 2010 01:42

Try this too, it should do exactly what you need

add_js_headline('
jQuery(function(){
    // Open all links in new window/tab
    jQuery(".widget_core_coll_link_list a[href^=\'http:\']").attr("target", "_blank");
});
');

4 Jun 15, 2010 02:49

Sam:

Thanks so much for the help, but it's not working. I assume that when you say "Add this code at the top" you mean below the first "<?php" tag?

Sorry, I'm really new to PHP. :)

5 Jun 15, 2010 03:50

What skin are you using?

6 Jun 15, 2010 03:53

I'm using a version of EvoCamp that I modified to be 3 columns.

7 Jun 15, 2010 04:14

Then you need to add the above code in all files ending on .main.php right after this

// Do inits depending on current $disp:
skin_init( $disp );

8 Jun 15, 2010 04:29

Still no luck. I sure appreciate your help though.

I added that code, (I tried both), to the 4 files that end with .main.php

The sidebar links still open in the same window.

The blog is at: richardfmiller.com

9 Jun 15, 2010 04:59

Got it!!

From reading some other posts, I realized that I had to add:

require_js( '#jquery#' );

to the beginning of your code.

Thanks a heap, Sam! You rock!


Form is loading...