Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-12 09:14:33

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

zem_prblock: links don't open in new window

my page template:

<txp:zem_prblock target="_blank">
<div class="banner_alumine" >
<txp:article_custom form="untitled" section="banner_alumine" />
</div>
</txp:zem_prblock>

plugin is activated but links don’t open in new window.
is it because of <txp:article_custom/> tag?

Offline

#2 2007-10-12 11:39:39

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: zem_prblock: links don't open in new window

  1. Works only to outgoing links.
  2. And it should work, but try to put it to inside the article forms.
  3. Remember that target-attribute is deprecated, so try using JavaScript.

Cheers!

Last edited by Gocom (2007-10-12 11:39:53)

Offline

#3 2007-10-12 11:58:59

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: zem_prblock: links don't open in new window

Gocom wrote:

Works only to outgoing links.

those are outgoing links

And it should work, but try to put it to inside the article forms.

i tryed this. my “untitled” form:

<txp:zem_prblock target="_blank">
<txp:body />
</txp:zem_prblock>

didn’t help

Remember that target-attribute is deprecated, so try using JavaScript.

i can’t javascript. can you help me here?

Last edited by Gallex (2007-10-12 12:00:29)

Offline

#4 2007-10-12 12:03:34

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: zem_prblock: links don't open in new window

In the form:

<txp:zem_prblock type="nofollow" rel="external"><!-- Your content here --></txp:zem_prblock>

And create JS file including:

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

Cheers!

Offline

#5 2007-10-12 12:19:53

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: zem_prblock: links don't open in new window

maybe there is still other, simplier solution? :)

Offline

#6 2007-10-12 12:25:41

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: zem_prblock: links don't open in new window

Er — simplier? Isn’t that quite really simple? And after all that’s only valid way, and what possibly could be easier than create one little JS-script & file and call it from page’s head-section.

Cheers!

Last edited by Gocom (2007-10-12 12:26:36)

Offline

#7 2007-10-12 14:36:36

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: zem_prblock: links don't open in new window

hi gallex, maybe you should read this little blog entry regarding new windows.

The ultimate decision is of course your but directing links to new windows definitely has some adverse effects.

>edit: A google search might also help your decision.

Last edited by colak (2007-10-12 14:42:35)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2007-10-13 08:02:15

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: zem_prblock: links don't open in new window

solved. the problem was in outgoing link address which started with https://www…

Offline

Board footer

Powered by FluxBB