In the 'page--landing.tpl.php' file, the menu is created with:
//--页面菜单添加新窗口打开的链接
<div id="menu">
<?php print $navigation; ?>
</div>
<?php
A quick way would be to use jQuery to rewrite the anchor tags in the menu with the target attribute
//--方法一,使用jquery
$( '.page--landing [menu link selector] ).attr( 'target','_blank' );
Using the Drupal API
//方法二:使用hook_menu_link_alert
function MODULE/THEMENAME_menu_link_alter(&$item)
{
if (some logic that sets it only for the desired paths/context)
{
$item['options']['attributes']['target'] = '_blank';
}
}
an example from the documentation for function hook_menu_link_alter
//一个例子
function MODULE/THEMENAME_menu_link_alter(&$item)
{
if($item['link_path']=="admin/tutorial14333")
{
$item['options']['attributes']['target'] = '_blank';
}
}
?>
http://drupal.stackexchange.com/questions/100769/how-to-create-a-navigation-main-menu-with-target-blank-on-specific-page-tpl?rq=1
板块
Drupal 版本