Posted By

shrop on 08/13/08


Tagged

drupal Themes


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Who likes this?

4 people have marked this snippet as a favorite

luman
basicmagic
troynt
panatlantica


Open external URLs in a new window - Drupal


Published in: PHP 






URL: http://agaricdesign.com/note/open-external-urls-a-new-window

PHP Template override by Benjamin Melançon of Agaric Design.

Expand | Embed | Plain Text
  1. <?php
  2. /**
  3. * Override theme_menu_item_link
  4. * <a href="http://api.drupal.org/api/function/theme_menu_item_link/5
  5. " title="http://api.drupal.org/api/function/theme_menu_item_link/5
  6. ">http://api.drupal.org/api/function/theme_menu_item_link/5
  7. </a> */
  8. function phptemplate_menu_item_link($item, $link_item) {
  9. // make external links open in new windows
  10. $attributes = !empty($item['description']) ? array('title' => $item['description']) : array();
  11. if (strpos($link_item['path'], 'http://') === 0 || strpos($link_item['path'], 'https://') === 0) {
  12. $attributes['target'] = '_blank';
  13. }
  14. return l($item['title'], $link_item['path'], $attributes, isset($item['query']) ? $item['query'] : NULL);
  15. }
  16. ?>

Report this snippet 

You need to login to post a comment.

Download royalty free graphics