Recent Topics

1 Aug 06, 2007 09:12    

My b2evolution Version: 1.9.x

Hi,

by writing a posting in the backoffice, I can use the "link"-button to add a href-link and a title. But I add mostly external links, which I would like to open in a new tab or window. For this currently I add the target="_blank" manually to the links... but I would like to make my lifeeasier :lol:

1) Which file I have to hack at which position, to add automatically the target="_blank" each time I use the "link"-button? I think this should be no difficult task, but I haven´t found the correct position yet.

2) In addition to the above, is there a possibility to mark external links with a symbol, so that everybody can see that this link is not an internal one?

Thanks for your help in advance...
Daniel

2 Aug 06, 2007 09:40

1) crack open plugins/quicktags.php and change this bit to add the target="_blank" ( this will add it to all links )

		function b2evoInsertLink(myField, i, defaultValue) {
			if (!defaultValue) {
				defaultValue = 'http://';
			}
			if (!b2evoCheckOpenTags(i)) {
				var URL = prompt('<?php echo T_('URL') ?>:' ,defaultValue);
				if (URL) {
					b2evoButtons[i].tagStart = '<a href="' + URL + '" target="_blank">';
					b2evoInsertTag(myField, i);
				}
			}

2) I add a class="ext" to all my external links, that way they can be styled differently

¥

3 Aug 06, 2007 22:15

Perfect again... that solves exactly my problem! Thank you very much!

4 Aug 08, 2007 19:42

Will this work for 1.10.02 as well?

EDIT: never mind, it does, once I properly read the directions!

5 Nov 07, 2007 06:43

function b2evoInsertLink(myField, i, defaultValue) {
			if (!defaultValue) {
				defaultValue = 'http://';
			}
			if (!b2evoCheckOpenTags(i)) {
				var URL = prompt('<?php echo T_('URL') ?>:' ,defaultValue);
				if (URL) {
					b2evoButtons[i].tagStart = '<a href="' + URL + '" target="_top">';
					b2evoInsertTag(myField, i);

I'm using "Navy Pier". My file looks like the above (it already has the _top). Problem is, when I add a link and save it it does not put the target into the link and I have to go back in and manually add it. What gives?, shouldn't it be there on all my links?

-Joel

6 Nov 07, 2007 14:33

hi Joel,

Looks like this is going to work in 2.0.2. Do you have the plugin installed and active?

Good luck

7 Jan 27, 2008 00:04

it took me quite a bit of searching on the forums but this thread just made my day :D

i wonder if the b2evo team could consider making some sort of "on/off" button or setting acceseble from the backoffice for external linking.

8 Mar 15, 2008 01:24

That's great, how can you do the same for links entered in the "Link to url:" field whilst posting?
Thanks in advance.

9 Mar 29, 2008 20:44

¥åßßå wrote:

2) I add a class="ext" to all my external links, that way they can be styled differently

¥

I am interested in applying this method.
I just wondered how you go about it. Do you manually add the class to the string whilst posting or is it automatic?

I guess you make a new class in your CSS file but is there anything else you need to do? Does the post know if the link is internal or external? if so how?

11 Apr 10, 2008 05:44

Walter, I'm a little lost on this. I installed the plugin/widget, and added the "js" line to my html header file, but I don't see where to put the "rel" line.

12 Apr 10, 2008 12:21

Hi cslepage!

Well, the widget is a drop-in replacement for the linkblog. Have you added the linkblog provided by the widget?

Although, I think that I can provide a plugin for _blank and another for the linkblog.

After that, add to your links:


<a href="link" rel="external">External Link</a>

13 Apr 10, 2008 12:50

Walter wrote:

Hi cslepage!

Well, the widget is a drop-in replacement for the linkblog. Have you added the linkblog provided by the widget?

Yes, and so far, it's identical the "normal" linkblog. Thought I'm assuming that's because I'm lacking the "rel" portion.

Although, I think that I can provide a plugin for _blank and another for the linkblog.

After that, add to your links:


<a href="link" rel="external">External Link</a>

Instead of just putting "http://www....."?

14 Apr 10, 2008 21:23

Yes, identical, but a little different:

- Id the widget settings, you can configure it to don't show categories on the linkblog
- You can configure the links to open on a new window.
- You can use tags in the linkblog posts as xfn relations.

- And you can open another links on new windows :) just add rel="external" to href

You just publish your linkblog posts as you have done until today :)

and, if you want another link to open on a external window, just do:


<a href="http://b2evolution.net" rel="external">b2evolution</a>

Allright?

15 Apr 10, 2008 21:26

Okay, now I see, these are two different activities.

So, the "rel" is for links I place in a blog post? And I would have to manually add the "rel" to each link?

16 Apr 10, 2008 21:29

Well, yes, it had to be done manually :(

Except for the links on the linkblog, if you set the widget to open the linkblog links on a new windows, it works automatically.

Do you want to make this automatic for all the links on your site?

I think that I could do a plugin for that.

17 Apr 10, 2008 21:30

That would be great. To be honest, I could add "target=blank" manually to each tag if I wanted to. Though I suppose I could go back and alter the quicktags.php file like I did in my old skin.

18 Apr 10, 2008 21:38

Well, I can work on the plugin by the weekend, I think. :D

19 Apr 10, 2008 21:39

I look forward to testing it!

20 Apr 10, 2008 22:29

I will try to implement this on my plugin!

21 Apr 04, 2010 04:25

Isn't target=blank deprecated? I use onclick="window.open(this.href); return false; to validate and get the same effect

22 Apr 04, 2010 12:03

Please don't dig up 2 year old posts

¥


Form is loading...