Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 07-22-2012, 02:15 AM
SpawnedX SpawnedX is offline
 
Join Date: Apr 2011
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add drop down to certain boards and not others.

I would like to add a drop down box to some of my boards. In this drop down box it would be a list of my prefixes for that board and when they click on one of the prefixes in the drop down it will sort that board by the prefixes.

I know I will have to have the forumdisplay template check the board ID and if is one of the board IDs I want the box on then display it. Could someone show me what the if statement would look like for checking the board ID? I can figure out the drop down menu part for myself.

Also on a related note, is there a way to add a tabid onto the address a board link opens?
Reply With Quote
  #2  
Old 07-22-2012, 02:20 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The search function already allows for searching and filtering by prefix. When you say "Sort the board" do you mean every forum or just the forum the member is viewing?
Reply With Quote
  #3  
Old 07-22-2012, 02:28 AM
SpawnedX SpawnedX is offline
 
Join Date: Apr 2011
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just the forum the member is looking at. This isn't filtering by prefix in the same manner. The forum covers a couple different models of cars and I have a prefix for each model. Currently I am using Lynne's plug to click on the prefixes and that will eliminate all threads without that prefix on the current board.

The problem is, the person has to search for a post with that prefix in the board they want to quick sort without fully searching. So if there is a drop down menu on the board at the top, they can just set it to whatever model they need to search for.
Reply With Quote
  #4  
Old 07-22-2012, 03:52 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, go to Plugins & Products in your admincp, Add new plugin, give it a name and description, use hook loaction "forumdisplay_query" add this code
PHP Code:
$frm = array(1,2,3,4,5,6);
if (
in_array($forumid$frm)) { 
$fld 'prefixid';      
$query"SELECT DISTINCT $fld FROM ".TABLE_PREFIX."thread";   
$result mysql_query($query) or die(mysql_error());    
$dropdown "<form>\r\n<select name='myfld'>";    
while(
$row mysql_fetch_assoc($result)) {  
    
$dropdown .= "\r\n<option value='$row[$fld]'>{$row[$fld]}</option>";}$dropdown .= "\r\n</select>\r\n<input type='hidden' name='f' value='$forumid'><input type='submit' value='Filter by Make (only for this page)' />\r\n</form>";  
  }

$vbulletin->input->clean_gpc('r''myfld',  TYPE_STR);  
$myfld $vbulletin->GPC['myfld'];   
if (!empty(
$myfld))   
{   
$hook_query_where .= " AND thread.{$fld} = '" $db->escape_string($myfld) . "' ";  

Replace the forumids (i,2,3,...etc) for the forums that you want this to work on, then in your forumdisplay template put this under $navbar
PHP Code:
$dropdown<br /> 
Reply With Quote
  #5  
Old 07-22-2012, 04:19 AM
SpawnedX SpawnedX is offline
 
Join Date: Apr 2011
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately it only printed $dropdown on the page.

Is there no way to just add to a template a basic if $forumid = 11 then do this style thing? I know it's messy, but this vB4 code looks nothing like what I am familiar with in vB3.

--------------- Added [DATE]1342934977[/DATE] at [TIME]1342934977[/TIME] ---------------

Even this doesn't work:

<vb:if condition="$forum[forumid] == 11">Show this if forum ID is 11.</vb:if>

I think I am just going to go back to vB 3.8.
Reply With Quote
  #6  
Old 07-22-2012, 04:39 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont have a copy of vb4 to work with at the moment, if you can wait a couple of days until i finish work i'll be able to check that out, or maybe someone will jump in before then, maybe you can try {vb:raw $dropdown}

Did you have the plugin enabled???
Reply With Quote
  #7  
Old 07-22-2012, 05:12 AM
SpawnedX SpawnedX is offline
 
Join Date: Apr 2011
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah I had it enabled. I have found a way to do it with a conditional if statement. That's good enough for me. Thanks though.
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.14649 seconds
  • Memory Usage 2,226KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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