Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 10-05-2016, 09:28 PM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Thread Prefix Variable to query

I want to display a certain banner when someone searches for threads with a given prefix.

I have tried a ton of variables and really have no idea and none of my searches have revealed anything.

Does anybody know what prefix variable to query in a conditional statement that will show as TRUE when someone searches with a given prefix?
Reply With Quote
  #2  
Old 10-05-2016, 09:35 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you paste some of the queries you have tried?

My guess is that you need a simple LIKE such as WHERE variable LIKE 'somestring%'
That will show all variables that start with somestring.

Or are you talking about actual thread prefixes that you can define in the AdminCP?
Reply With Quote
  #3  
Old 10-06-2016, 12:27 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In addition to what Dave asked, please post the hook location you are using for the query or the code script/area you are adding it. You may be using a variable that isn't available in the hook/script you are putting it in.
Reply With Quote
  #4  
Old 10-06-2016, 01:47 AM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Essentially, I would like to trigger this banner when a specific search where all threads with the same prefix are displayed.

I am planning to put the conditional in: ad_navbar_below
and trigger it on the search script pages (as mentioned):

Ultimately I plan to join these two conditionals. The first is working
Code:
<if condition="THIS_SCRIPT == 'search'"></if>

None of these have worked; my prefix ID is exterior.  I have tried:

<if condition="$prefixid == exterior">banner code</if>
<if condition="$prefixid == 'exterior'">banner code</if>
<if condition="$prefixchoice == 'exterior'">banner code</if>
<if condition="$prefixchoice[exterior]">banner code</if>
<if condition="$prefixchoice['exterior']">banner code</if>
<if condition="$prefixchoice == 'exterior'">banner code</if>
<if condition="$prefixchoice == exterior">banner code</if>
<if condition="$prefix_selected['exterior']">banner code</if>
<if condition="$prefix_selected[exterior]">banner code</if>
<if condition="$prefix_selected == exterior">banner code</if>
<if condition="$prefix_selected == 'exterior'">banner code</if>
--------------- Added [DATE]1475787179[/DATE] at [TIME]1475787179[/TIME] ---------------

Bump
Reply With Quote
  #5  
Old 10-06-2016, 07:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The search page allows you to select multiple prefixes. So, you are going to need to put code in a hook to take the prefixchoice array and explode it before you can actually use it in a condition.
Reply With Quote
  #6  
Old 10-06-2016, 08:19 PM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow Lynne, thank you!

Can you provide any guidance on how I might be able to accomplish that?

Go easy on this amateur!
Reply With Quote
  #7  
Old 10-06-2016, 11:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you look at the search.php file and do a search on "prefixchoice", you will see them take the variable and then explode it to get something that is useful.
Reply With Quote
  #8  
Old 10-07-2016, 09:06 PM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you talking about this code?

PHP Code:
if ($prefixchoice)
                {
                    
$prefix_sql = array();
                    foreach (
explode(','$prefixchoice) AS $prefixid)
                    {
                        if (
$prefixid == '-1')
                        {
                            
// no prefix
                            
$prefix_sql[] = "''";
                        }
                        else
                        {
                            
$prefix_sql[] = "'" $db->escape_string($prefixid) . "'";
                        }
                    }
                    
$thread_query_logic[] = "thread.prefixid IN (" implode(','$prefix_sql) . ")";
                }

                (
$hook vBulletinHook::fetch_hook('search_process_fetch')) ? eval($hook) : false
Reply With Quote
  #9  
Old 10-08-2016, 02:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, that is an example of exploding it into an array, yes.
Reply With Quote
  #10  
Old 10-18-2016, 03:54 PM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your input and response.

If I understand correctly, would creating the following in a hook named 'prefix_choice_array_explode' work for my purposes?

Code:
if ($prefixchoice)
                {
                    $prefix_sql = array();
                    foreach (explode(',', $prefixchoice) AS $prefixid)
                    {
                        if ($prefixid == '-1')
                        {
                            // no prefix
                            $prefix_sql[] = "''";
                        }
                        else
                        {
                            $prefix_sql[] = "'" . $db->escape_string($prefixid) . "'";
                        }
                    }
                    $thread_query_logic[] = "thread.prefixid IN (" . implode(',', $prefix_sql) . ")";
                }

                ($hook = vBulletinHook::fetch_hook('prefix_choice_array_explode')) ? eval($hook) : false;
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 01:22 AM.


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.04894 seconds
  • Memory Usage 2,257KB
  • 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_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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