This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » General » Open the link in a new window
expandshrink

Open the link in a new window

Open the link in a new window

Thursday 28 January 2010 9:57:10 am - 1 reply

Help please.
I need that links to other domains opened in a new window.

I am in the template design/standard/templates/content/datatype/view/ezurl.tpl added target="_blank", but then all links open in a new window.

{section show=$attribute.data_text}
<a href="{$attribute.content}" target="_blank">{$attribute.data_text|wash( xhtml )}</a>
{section-else}
<a href="{$attribute.content}">{$attribute.content|wash( xhtml )}</a>
{/section}

Has found at a forum this code but as it to apply in a template ezurl.tpl I do not understand.

 {if $target} target="{$target}{elseif and( $href|contains('http://'), not( $href|contains('http://www.yourdomain.net') ) )} target="_blank"{/if}

Modified on Thursday 28 January 2010 10:00:41 am by Kruglova Natasha

Thursday 28 January 2010 10:48:54 am

Please help me!

Question:

1. Please get me variable with my domain. Example midisa.net

2. How to do comparisons of variables? Coincidence and a finding contained in the text is necessary not precisely. For example I need to find, eat a name of my domain in a variable or not.

3. How correctly to write conditions? In one cases you write {if} {else} {/if} in other cases you use {if} {elseif} {endif}. You are not confused?

Please edit a code which it is resulted more low that it worked. This code is taken from a template ezurl.tpl

{if not( $attribute.content|contains('midisa.net')}
{$target = "_blank"}
{else}
{$target = "_self"}
{/if}

{section show=$attribute.data_text}
<a href="{$attribute.content}" target="{$target}">{$attribute.data_text|wash( xhtml )}</a>
{section-else}
<a href="{$attribute.content}" target="{$target}">{$attribute.content|wash( xhtml )}</a>
{/section}

Modified on Thursday 28 January 2010 10:55:19 am by Kruglova Natasha

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from