Uutiset:

Join the Facebook Fan Page.

Main Menu
Advertisement:

'target' in button array

Aloittaja Krashsite, marraskuu 19, 2013, 04:52:58 IP

« edellinen - seuraava »

Sir Osis of Liver


I've used this before, but now it doesn't work -



'donate' => array(
'title' => 'Donate',
'href' => 'http://www.domain.com/forum/donate.htm',
'show' => true,
'target' => '_blank',
'sub_buttons' => array(
),
),



Should open in new window, but loads into same window. 

When in Emor, do as the Snamors.
                              - D. Lister

Kays

If you're not using the default theme. In the template_menu function in index.template.php verify that the check for target has been added. That's in three places. Once for each menu level


, isset($button['target']) ? ' target="' . $button['target'] . '"' : '',


Or this usually works. ;)


'href' => 'http://www.domain.com/forum/donate.htm" target="_blank',



If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Sir Osis of Liver


This works, but removes the css formatting from the title -



'donate' => array(
'title' => '<span style="color: yellow; font-weight: bold;">DONATE</span>',
'href' => 'http://www.domain.com/forum/donate.htm" target="_blank" ',
'show' => true,
'sub_buttons' => array(
),
),



Will try the other when I get back tonight.

When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver

Ok, got it -



foreach ($context['menu_buttons'] as $act => $button)
{
if($button['active_button'])
echo '<td class="maintab_active_first">&nbsp;</td>
<td  class="maintab_active_back">
<a href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>' , $button['title'] , '</a>
</td><td class="maintab_active_last">&nbsp;</td>';
else
echo '
<td  class="maintab_back">
<a href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>' , $button['title'] , '</a>
</td>';
}



Thanks, Kays.

When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: