|
01-28-2005, 07:10 AM | #1 |
Green Mole
Join Date: Jan 2005
Posts: 9
|
Refine search, but not based on path
In reply to: http://www.phpdig.net/forum/showthre...ghlight=refine
This is a very basic hack to allow the user to refine her/his search by selecting a radio button below the search-box. First of all let me say that I'm very new to phpdig and I'm sure there are better ways to achieve what I'm trying to do here. Please let me know THE modded FILE: libs/function_phpdig_form.php Around line 197... I have put this (the head of the form): Code:
$result['form_head'] = " <script> function radioValue(radioButton) { for (var x = 0; x <= radioButton.length-1; x++) { if (radioButton[x].checked == true) return radioButton[x].value; } return radioButton.value; } </script> <form action='$result_page' method='post' name='soegeform' onsubmit=\"document.soegeform.query_string.value=document.soegeform.query_string.value + ' ' + radioValue(refine_search)\";> <input type='hidden' name='site' value='$site'/> <input type='hidden' name='path' value='".htmlspecialchars($path,ENT_QUOTES)."'/> <input type='hidden' name='template_demo' value='$template_demo'/> <input type='hidden' name='result_page' value='$result_page'/> "; Code:
$result['form_foot'] = " <input type='radio' name='refine_search' value='anatomi' checked>Alt <input type='radio' name='refine_search' value='soeg_emner'>Emner <input type='radio' name='refine_search' value='placering=main'>Præparater <input type='radio' name='refine_search' value='soeg_oevrige'>Øvrige sider </form>"; anatomi soeg_emner placering=main AND soeg_oevrige ...I will paste them into my documents before I do my digging... It works like this: When the user has selected a radio button and pressed the submit-button the JavaScript on the submit-button pastes the radio button-value into the search-box along whit what the user put (if anything). This is (naturally) done before the values are passed to the search-script (action='$result_page'). Maybe this can inspire someone? Maybe someone can achieve the same in a more clever way? God I hate JavaScript Last edited by kristian; 01-28-2005 at 07:14 AM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
refine search to two or more urls | fmehl | How-to Forum | 2 | 10-01-2006 01:52 PM |
Limit search to this path returns no results | mixle | Bug Tracker | 2 | 05-30-2005 11:24 PM |
Forcing a page to always show up first in search results based on keyword | derrickp | How-to Forum | 3 | 02-22-2005 01:01 PM |
search_function.php: allow to exclude path(s) [based on 1.8.7] | blueyed | Mod Submissions | 0 | 01-27-2005 04:13 AM |
refine search but not based on path... | zevince | How-to Forum | 3 | 07-08-2004 09:30 AM |