The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
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? |
#3
|
||||
|
||||
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.
|
#4
|
|||
|
|||
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> Bump |
#5
|
||||
|
||||
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.
|
#6
|
|||
|
|||
Wow Lynne, thank you!
Can you provide any guidance on how I might be able to accomplish that? Go easy on this amateur! |
#7
|
||||
|
||||
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.
|
#8
|
|||
|
|||
Are you talking about this code?
PHP Code:
|
#9
|
||||
|
||||
Well, that is an example of exploding it into an array, yes.
|
#10
|
|||
|
|||
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; |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|