How to have redirect boards open in a new tab or window?

Started by ApplianceJunk, January 18, 2013, 11:16:16 PM

Previous topic - Next topic

ApplianceJunk

Is there a setting that lets you choice to open a redirect board in a new tab?

If not can the code be easily manually edited to allow redirect boards to open in a new tab?

Thanks,

Arantor

There is not a setting for it. I remember adding one being a pain in the crotch.

If you want it on a per board setup, it's a real pain, though doing it for all redirect boards is not so bad.

ApplianceJunk

Doing it for all redirect boards is what I had in mind.

Could you give me some direction on how to go about it?

Thanks,

Arantor

Sure, edit BoardIndex.template.php (and this will be pretty much as-is again in MessageIndex.template.php if you have child boards that are redirects)

<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';


<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '"', $board['is_redirect'] ? ' target="_blank"' : '', '>', $board['name'], '</a>';


Arantor


ApplianceJunk

I just noticed when I click on the redirect icon it opens the board in the same window.

How would I edit the code so clicking on the redirect icon also opens the redirect board in a new window?


Hj Ahmad Rasyid Hj Ismail

It could be this line:

<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

May be change it to: ?
<a href="', ($board['is_redirect'] ' target="_blank"' || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';

ApplianceJunk

ahrasis, that did not seem to work.

I get this when I tried it.

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/applianc/public_html/forums/Themes/default/BoardIndex.template.php on line 186

Kays

Try this instead.


<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '" target="_blank">';

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


ApplianceJunk

Kays, after some more testing it does not work as I had in mind.

Your edit ends up opening all the board icons in new tabs. I would like to have just the redirect icons open in new tabs, if that is possible.

Thanks,


Arantor

<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '"', $board['is_redirect'] ? ' target="_blank"' : '', '>';

ApplianceJunk

Arantor, that works great! Thank you.

I was just looking at the code you provided originally to the code I have been giving for the redirect icon and thinking I must need a $board['is_redirect'] in there someplace, but did not know how to go about it.

Maybe someday I will be able to figure more of this stuff out on my own.

Thanks everyone.

Hj Ahmad Rasyid Hj Ismail

Sorry for the trouble ApplianceJunk. And thanks for the above guide guys. I am learning a lot on how code and to place the code at the right place today. :D


suresh1983

Hi,

I am trying to use this plugin but couldn't find the code that is mentioned in my forum. I am using vertex theme.

Please help in using this plugin successfully.

Kindred

hi suresh... mod specific questions should be asked in the thread dedicated to supporting that mod. (linked on the page where you downloaded the mod from)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: