Recent Topics

1 Jan 28, 2009 17:26    

My b2evolution Version: Not Entered

I want to set it so that up so that when a user leaves a comment on my blog, the users web address (when clicked) will open into a new window. I'm not really sure how to set the target=_blank. You can see that on the first comment left on my blog, the user's web address opens in the same window when clicked from both the comment itself, and from my "Recent Comments" widget in the sidebar:

http://www.vaughnstreet.com/blog/streetstories.php/2009/01/25/look-who-s-talking

Does someone know how to do this? Thanks!

2 Feb 01, 2009 00:21

Nope. No one knows how to do this. Fortunately *I* discovered a method previously unknown to our species. A method that, coincidentally, can make this happen. Here, for the first time ever, a method that forces commenter's web addresses to open in a new window!

This, by the way, assumes v246 ... and is probably okay on v245 if that's your thing.

So crack open inc/comments/model/_comment.class.php and look for something that looks quite like this:

		if( $makelink )
		{
			$r .= '<a ';
			if( $this->nofollow )
			{
				$r .= 'rel="nofollow" ';
			}
			$r .= 'href="'.$url.'">';
		}

Now, using the powers of your mind (and keyboard ;) ) bend it to your will with changes like this:

		if( $makelink )
		{
			$r .= '<a ';
			if( $this->nofollow )
			{
				$r .= 'rel="nofollow" ';
			}
			$r .= 'href="'.$url.'" target="_blank">';
		}

By the way I would like to point something out here. You mentioned how clicking the link of a commenter caused the new page to open in the same window. For me that is partially true. Same window, but a new tab. Must be a Firefox thing eh?

Oh and this is completely untested, so please do have a backup of the file handy just in case it breaks your blog. Oh and if it actually melts your server PLEASE tell me so I can brag about my awesome server-melting powers :)

3 Feb 01, 2009 00:21

BTW I really like your skin. I wish it was public cuz I have an application in mind where it would be a great starting point.

4 Feb 03, 2009 23:35

Ed, you did it! Thanks man. I can confirm that it works perfectly. Well done.

And to answer your question, some browsers I tested it on open the link in a new window and other browsers open it in a new tab

Also, what does it mean for a blog skin to be public?

5 Feb 04, 2009 01:04

It means you put all the files in a .zip and submit it to the skins site, where anyone and their otter can help themselves to it. :)

Instead of forcing me to grab your style sheet and try to reconstruct your index.main.php file ... then hope you never notice and call me a poopyheaded skin thief ;)


Form is loading...