Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2004, 12:30 PM
welo welo is offline
 
Join Date: Jan 2004
Location: Portland, Oregon
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 08-10-2004, 01:23 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
to:
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>
Reply With Quote
  #3  
Old 08-10-2004, 10:10 PM
welo welo is offline
 
Join Date: Jan 2004
Location: Portland, Oregon
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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">
Maybe?
Reply With Quote
  #4  
Old 08-11-2004, 12:54 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)">
This one means, "If the forum is of type link, then and only then, check that the forumid is one of the ones listed. If both these conditions are true, then include the HTML code.
Reply With Quote
  #5  
Old 08-11-2004, 01:27 PM
welo welo is offline
 
Join Date: Jan 2004
Location: Portland, Oregon
Posts: 172
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 08-11-2004, 01:47 PM
vonedaddy's Avatar
vonedaddy vonedaddy is offline
 
Join Date: Jan 2004
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 08-11-2004, 02:07 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 09-17-2004, 12:29 PM
ZnARk ZnARk is offline
 
Join Date: Jun 2002
Location: Sweden
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
but get
Quote:
Parse error: parse error in /web/pbnorr/web/forum/includes/adminfunctions_template.php(3055) : eval()'d code on line 14
When im trying to save.
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">&nbsp;</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
Reply With Quote
  #9  
Old 09-17-2004, 06:38 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:58 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04041 seconds
  • Memory Usage 2,243KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete