The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Redirect links in new window
Has anyone already devised a way to have an option where when a forum is a redirect link it opens in a new browser window? If not I'd appreciate some guidance on where I'd need to start looking to hack this in.
Preferably there would be an option in the forum manager directly under "Forum Link" for "New Window" or "Same Window". Otherwise just knowing where to tag in target="_blank" would help. Thanks. |
#2
|
|||
|
|||
This ain't pretty, but it should work...
Modify the template forumhome_forumbit_level2_nopost to output a different <a> tag. The default is to output a tag that points to forumdisplay.php, and in that script it notices that the forum is a link and send an HTTP header to change the LOCATION. Anway, let's assume you want this only done for a certain forum, say, forumid of 12. In the forumhome_forumbit_level2_nopost template, change the line: Code:
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a> Code:
<if condition="$forum['link'] AND $forum['forumid']==12"> <a href="$forum[link]" target="_blank">$forum[title]</a> <else /> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a> </if> |
#3
|
|||
|
|||
Hey, thanks man. So what if there is more than one forum like this? Use:
Code:
<if condition="$forum['link'] AND $forum['forumid']==12, 15, 22, 27"> |
#4
|
|||
|
|||
No. The stuff in <if condition="STUFF"> must be well formed PHP.
There are various ways to check that a single value, such as forumid, is a member of a set. Here's one that will work for you: Code:
<if condition="$forum['link'] AND in_array($forum['forumid'], array(12, 15, 22, 26)"> |
#5
|
|||
|
|||
Ah, thanks again. I shoulda remembered that one because I used a similar array to make the "who viewed this thread" hack restricted to admin usergroups.
You're right about it being a little messy though. I'd hack this into my board but I'm also needing a similar solution for a client for sponsor and advertiser links, and this would be a bit much for them to grasp. I'll keep playing with it and see what I can do about adding something to the ACP to control it. I figure making something equal 1 in a new tinyint db field for target="_blank" and an if/else statement should do it. |
#6
|
||||
|
||||
I have the opposite problem... My forum links open in a new window and I would like it to open in the same window... Any suggestions??
FYI my site is hereyah.com you can goto http://hereyah.com/forums/ and click on the links database to see what I mean |
#7
|
|||
|
|||
vonedaddy:
Different problem. You are using the "Links and Files Database" hack. welo is talking about forums that are defined to be links, a standard vB feature -- they are listed like other forums, but they are not really forums, just links to some URL. |
#8
|
|||
|
|||
As the newbie i am I have changed to
Code:
<if condition="$forum['link'] AND in_array($forum['forumid'], array(10, 12, 13, 14, 18, 15)"> <a href="$forum[link]" target="_blank">$forum[title]</a> <else /> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a> </if> Quote:
Btw im using v3.0.3 Here is my original forumhome_forumbit_level2_nopost template and i want forum 10, 12, 13, 14, 18, 15 to open in new windows. Code:
<tr> <td class="tcat"><span class="smallfont"> </span></td> <td class="tcat" colspan="<if condition="$vboptions['showmoderatorcolumn']">5<else />4</if>"> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a> <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if> <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if> </td> </tr> $childforumbits |
#9
|
|||
|
|||
You are missing a closing parenthesis before the closing quote of the condition="" clause. You have one there to close array, but you need one to close in_array.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|