Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Sir Osis of Liver - marraskuu 19, 2013, 04:52:58 IP

Otsikko: 'target' in button array
Kirjoitti: Sir Osis of Liver - marraskuu 19, 2013, 04:52:58 IP

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. 

Otsikko: Re: 'target' in buttonj array
Kirjoitti: Kays - marraskuu 19, 2013, 07:06:19 IP
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',


Otsikko: Re: 'target' in buttonj array
Kirjoitti: Sir Osis of Liver - marraskuu 20, 2013, 01:00:06 IP

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.

Otsikko: Re: 'target' in button array
Kirjoitti: Sir Osis of Liver - marraskuu 20, 2013, 10:54:31 IP
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. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Fthu.gif&hash=f4392e100b91a27ad55c137fafc83bec6aefd9cf)