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
Description

Is it possible to have set outgoing links to open in new window?

#1

designerbrent - March 18, 2007 - 21:24

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

designerbrent - April 15, 2007 - 13:54
Status:active» fixed

#3

PCanzona - April 28, 2007 - 23:13

In the Garland theme, exactly which tpl file would you add this to?

Pete

#4

designerbrent - April 29, 2007 - 02:26

that should go in your node.tpl.php file if memory serves me correctly.

#5

PCanzona - April 29, 2007 - 05:35

Hi, here's the code from Garland's node.tpl.php file:

<?php
phptemplate_comment_wrapper
(NULL, $node->type);
?>

<?php
print $picture
?>

<?php
if ($page == 0):
?>

<?php
print $node_url
?>

" title="
<?php
print $title
?>
" rel="nofollow">
<?php
print $title
?>

<?php
endif;
?>

<?php
if ($submitted):
?>

<?php
print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created)));
?>

<?php
endif;
?>

<?php
print $content
?>

<?php
if ($taxonomy):
?>

<?php
print $terms
?>

<?php
endif;
?>

<?php
if ($links):
?>

<?php
print $links;
?>

<?php
endif;
?>

Where exactly would I place "<?php
print $leech_news_item->link
?>

" target="_blank" title="
<?php
print $title
?>
" rel="nofollow">
<?php
print $title
?>
" to make it work? I've tried several places already.

Thanks much,

Pete

#6

designerbrent - April 29, 2007 - 20:10

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

PCanzona - April 29, 2007 - 20:43

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

designerbrent - April 29, 2007 - 22:30

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

PCanzona - April 30, 2007 - 01:23

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

designerbrent - April 30, 2007 - 13:52

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

Dries - May 14, 2007 - 20:38
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.