Search with only selected prefix ids
zigi Offline
Junior Member
**
Posts: 6
Joined: May 2011
Post: #1
Question Search with only selected prefix ids
Hi everyone,

  [Image: th_538402742_ddfgdfg_122_1054lo.JPG]

Im trying to change searching prefix option by using only selected prefixes not all of them. As i understood this is indicated at search.php line 1527:

Code:
$prefixselect = build_prefix_select('all', 'any', 1);


Please help me to change that 'all' to a list of prefix ids, if there are totally 10 prefixes ids, how to filter only by 4 selected prefixes ? (if i have 10 prefixes, how to show only 4 prefixes in the search option?)
Here is the execution code:

Code:
1
2
3
4
5
6
7
<select name="threadprefix" multiple="multiple" size="5">
<option value="any" selected="selected">Find threads with any prefix</option>
<option value="0">No prefix</option>
<option value="7">Red</option>
<option value="8">Blue</option>
<option value="10">Green</option>
</select>


Thanks for attention

05-15-2011 02:50 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Search with only selected prefix ids
I think the "easiest" way is, put the HTML form directly in your search template.
Otherwise, I think you need to edit the build_prefix_select function in functions.php file manually.

05-15-2011 04:21 AM
Find all posts by this user Quote this message in a reply
zigi Offline
Junior Member
**
Posts: 6
Joined: May 2011
Post: #3
RE: Search with only selected prefix ids
Thanks for taking time looking at my question.

In the search template its referred to $prefixselect (functions.php - as you said)

Quote:}
$prefixselect = "";
if($db->num_rows($query) > 0)
{
$multipleselect = "";
if($multiple != 0)
{
$multipleselect = " multiple=\"multiple\" size=\"5\"";
}
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";
if($multiple == 1)
{
$any_selected = "";
if($selected_pid == 'any')
{
$any_selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n";
}
$default_selected = "";
if((intval($selected_pid) == 0) && $selected_pid != 'any')
{
$default_selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n";
while($prefix = $db->fetch_array($query))
{
$selected = "";
if($prefix['pid'] == $selected_pid)
{
$selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";
}
$prefixselect .= "</select>\n&nbsp;";
}
return $prefixselect;

Ive made all variants that i could but or it has no needed effect or the search.php stoped working at all Tongue.
Im sorry but i just cant read the code properly, please help me.
05-15-2011 07:16 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Search with only selected prefix ids
You need to edit the query (above the codes), maybe using a variable, and use condition so the modification only works in search.php.

For search results, I think you need to edit the query in search.php too.

05-15-2011 07:33 AM
Find all posts by this user Quote this message in a reply
zigi Offline
Junior Member
**
Posts: 6
Joined: May 2011
Post: #5
RE: Search with only selected prefix ids
Thanks for answering.
I im just trying to modify the list of selectable prefixes, i don't want to change the search code, only not me Biggrin.
So will go the experiment way, what if i change that, and so on Biggrin.

Thanks for your explanations, they were useful. Wink
05-15-2011 07:50 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Search with only selected prefix ids
As RateU said earlier, your easiest option is just to edit your search template - replace

Code:
{$prefixselect}

with

Code:
1
2
3
4
5
6
7
<select name="threadprefix" multiple="multiple" size="5">
<option value="any" selected="selected">Find threads with any prefix</option>
<option value="0">No prefix</option>
<option value="7">Red</option>
<option value="8">Blue</option>
<option value="10">Green</option>
</select>


Note that this will cause it to ignore all group permissions, or if you delete a prefix later, you'll also have to remember to remove it from the above code.


My Blog
(This post was last modified: 05-15-2011 10:50 AM by ZiNgA BuRgA.)
05-15-2011 10:48 AM
Find all posts by this user Quote this message in a reply
zigi Offline
Junior Member
**
Posts: 6
Joined: May 2011
Post: #7
RE: Search with only selected prefix ids
Its works Yipi

[Image: th_443901468_madprof_122_205lo.jpg]

Thank you very much RateU and ZiNgA BuRgA. Wink2
05-15-2011 05:23 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: