Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 3
Opening link in new window
 
Template fans
Guru
 
Total Posts:  446
Joined:  2009-11-02
 

Just add target="_blank" tag.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Joey H
Member
 
Avatar
Total Posts:  49
Joined:  2008-07-29
St. Louis, MO
 

is there anyway to post the full path in the xml

Like this

<block type="core/template" after="-" name="left.permanent.callout-5" template="callouts/left_col.phtml">
                <
action method="setImgSrc"><src>http://www.scpraceparts.com/skin/frontend/default/f002/images/co-small-facebook.jpg</src></action>
                
<action method="setImgAlt" translate="alt" module="catalog"><alt>Follow Us On FACEBOOK!.</alt></action>
                <
action method="setLinkUrl"><url>http://www.facebook.com/#!/racingparts</url></action>
            
</block>
 
Magento Community Magento Community
Magento Community
Magento Community
 
GregC
Sr. Member
 
Avatar
Total Posts:  76
Joined:  2007-11-23
A^2, MI
 

There’s a typo in the img tag line

should be

<img src="<?php echo $this->getSkinUrl($this->getImgSrc()) ?>"  alt="<?php echo $this->__($this->getImgAlt()) ?>" title="<?php echo $this->__($this->getImgTitle()) ?>" />

note the () after getImgTitle

Greg

 
Magento Community Magento Community
Magento Community
Magento Community
 
webhister1
Jr. Member
 
Total Posts:  2
Joined:  2010-06-19
 

If you add a target="_blank", the page will open in a new window:

"<a href="http://www.yahoo.com" target="_blank">Go to Yahoo</a>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Uncle Monty
Jr. Member
 
Total Posts:  13
Joined:  2009-11-26
 

Hi there,

I know the target="_blank" method gets the job done but it is not allowed in valid Strict xHTML.

On other sites I have used the javascript method rel="external" but this doesn’t seem work with Magento.

Does anyone know a valid Strict xHTML method that will work with Magento to get a link to open in a new window?

Any help gratefully received.

Cheers,

Uncle M.

 
Magento Community Magento Community
Magento Community
Magento Community
 
naturalcrusader
Jr. Member
 
Total Posts:  16
Joined:  2010-08-12
 

I could not get the new action to work by adding the action tag with new target, I also didn’t want to change the callback phtml file, so I came up with another solution

<action method="setLinkUrl"><url>http://url" target="_blank</url></action>

when they parse the file they pull everything from within the url tag, so following an INJECTION TYPE ATTACK it will place the url and then the target, notice that there is no open “ and no closing “

 
Magento Community Magento Community
Magento Community
Magento Community
 
Uncle Monty
Jr. Member
 
Total Posts:  13
Joined:  2009-11-26
 

Hi there,

For those wanting to know as standards compliant method of opening links in a new window using the Strict DTD, I have just found this article at: http://articles.sitepoint.com/article/standards-compliant-world

Once you have created and uploaded the .js file, add the code:

<script type="text/javascript" src="LOCATION OF ABOVE .JS FILE HERE"></script>

to: System > Configuration > Design > HTML Head > Miscellaneous Scripts

You can now use: rel="external" instead of target="_blank" in your links and your pages should validate as Strict xHTML.

Hope that helps someone.

Cheers,

Uncle M.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Uncle Monty
Jr. Member
 
Total Posts:  13
Joined:  2009-11-26
 

Hi all,

After searching and searching for the answer above, I’ve just stumbled across a far easier was of achieving this:

<a href="yourexternallink.html" onclick="this.target='_blank'">Opens in External Widow</a>

The onlick parameter must be already part of of Magentos library.

Cheers,

Uncle M.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ajwsalsa
Jr. Member
 
Total Posts:  3
Joined:  2009-03-03
 

@naturalcrusader

Thanks for the ANSWER

thank you for posting a quick 2 minute fix to this problem—with all of needed information to implement properly.

I worked on this problem for an hour before finding your post @naturalcrusader

See naturalcrusader post above—for a quick solution to link problem

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andy_GS
Sr. Member
 
Total Posts:  126
Joined:  2010-05-21
 

Hi,
i just wanted to further what naturalcrusader said.

this worked for me:

<action method="addLink" translate="label title">
<
label>Some Label</label>
<
url>http://www.someurl.com" target="_blank" rel="nofollow</url>
<title>Some title</title>
<
prepare/>
<
position>(the position number if you have several links)</position>
<
liParams/>
<
aParams></aParams>
<
beforeText></beforeText>
<
afterText></afterText>
</
action>

this is the code i used when i wanted to display an external link that opens in a new window + having the rel="nofollow" so google doesn’t go off down it with spidering.

Andy.

 
Magento Community Magento Community
Magento Community
Magento Community
 
eddieb
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-04-17
Rio de Janeiro, Brazil
 
Uncle Monty - 08 September 2010 02:35 AM


<a href="yourexternallink.html" onclick="this.target='_blank'">Opens in External Widow</a>

This is by far the quickest and easiest standards compliant way to add a link that opens in a new window. Load yet one more JavaScript? No thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
olegnax
Member
 
Avatar
Total Posts:  51
Joined:  2012-03-22
Mukolaev, Ukraine
 
Andy_GS - 04 May 2011 07:00 AM

Hi,
i just wanted to further what naturalcrusader said.

this worked for me:

<action method="addLink" translate="label title">
<
label>Some Label</label>
<
url>http://www.someurl.com" target="_blank" rel="nofollow</url>
<title>Some title</title>
<
prepare/>
<
position>(the position number if you have several links)</position>
<
liParams/>
<
aParams></aParams>
<
beforeText></beforeText>
<
afterText></afterText>
</
action>

this is the code i used when i wanted to display an external link that opens in a new window + having the rel="nofollow" so google doesn’t go off down it with spidering.

Andy.

Confirm. Working great. Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
sparefroh
Member
 
Total Posts:  51
Joined:  2013-01-29
 

Hey guys,

Has anyone a easy solution for this problem?

Cause i try this but it doesn’ work

<reference name="right">
<block type="catalog/product_compare_sidebar" after="-" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<block type="core/template" name="right.permanent.callout4" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/calloutsRight/twitter.jpg</src></action>
<action method="setImgAlt" translate="twitter" module="catalog"><twitter>Follow us on twitter!</twitter></action>

<a href="https://twitter.com/***_" target="_blank"></a>
</block>
</reference>

Thank’s for any help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
searchmydegree
Jr. Member
 
Total Posts:  5
Joined:  2013-04-12
 
fbords - 08 December 2008 03:55 PM

I changed one of the default callouts to a map of my physical store location. I successfully changed the link it points to, however I’d like it to open in a new window. The line i need help with is:

<action method="setLinkUrl"><url>http://www.mylink.com</url></action>

what’s the equivelant to target="_blank" and where in the tag above does it go?

I tried this its not working can you please help ?

Colleges Of Animation

 
Magento Community Magento Community
Magento Community
Magento Community
 
magebay
Sr. Member
 
Avatar
Total Posts:  122
Joined:  2012-10-09
Thai Nguyen
 

This extension Menu Creator Pro maybe help you. It allowed open a link in same window or new window.
You can also check on Wiki page

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 3