Out going links
gumdrop - March 17, 2007 - 14:53
| Project: | Leech |
| Version: | 5.x-1.x-dev |
| Component: | leech |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Is it possible to have set outgoing links to open in new window?

#1
gumdrop,
Try this in your tpl file:
<a href="<?php print $leech_news_item->link ?>" target="_blank" title="<?php print $title ?>"><?php print $title ?></a>Brent
#2
#3
In the Garland theme, exactly which tpl file would you add this to?
Pete
#4
that should go in your node.tpl.php file if memory serves me correctly.
#5
Hi, here's the code from Garland's node.tpl.php file:
<?phpphptemplate_comment_wrapper(NULL, $node->type);
?>
<?phpprint $picture
?>
<?phpif ($page == 0):
?>
" title="<?phpprint $node_url
?>
<?phpprint $title
?>
<?phpprint $title
?>
<?phpendif;
?>
<?phpif ($submitted):
?>
<?phpprint t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created)));
?>
<?phpendif;
?>
<?phpprint $content
?>
<?phpif ($taxonomy):
?>
<?phpprint $terms
?>
<?phpendif;
?>
<?phpif ($links):
?>
<?phpprint $links;
?>
<?phpendif;
?>
Where exactly would I place "
" target="_blank" title="<?phpprint $leech_news_item->link
?>
<?phpprint $title
?>
<?phpprint $title
?>
Thanks much,
Pete
#6
Pete,
If you are modifying Garland just for your Leech theme this will be fine.
Replace line 8 of node.tpl.php with the following:
<h2><a href="<?php print $leech_news_item->link ?>" target="_blank" title="<?php print $title ?>"><?php print $title ?></a></h2>Cheers,
Brent
#7
Hi Brent,
I replaced line 8 in node.tpl.php with your code and, for some reason, the link is still opening up in the same window or tab (in I.E. and Firefox, respectively). Any ideas why this could be? I really don't want users redirected away from the site.
Thanks for all your time.
Pete
#8
Pete,
My guess is that you may be trying a different link? This snippit will change the title link on the teaser view of the item, not the link list at the bottom of each node. (I'm not sure how to change those links, sorry!)
Cheers,
Brent
#9
Hi Brent, Yes you are right: The header link works perfectly now (opens in a different window/tab). Is there a way to suppress the display of the "read original article" link in the teaser list?
Thanks so much,
Pete
#10
I haven't played with the module that far, but the obivious way is to comment out the 'print $links; ' line.
Good luck.
Brent
#11