I’m must be missing something here.
I’ve created my own custom DB search, but also still using AjaxSearch for the website retrieval.
I’m trying to make a radio button so the search text input will have ’search in website’ (AjaxSearch) and ’search in database’ (custom).
But the searchSwitcher snippet does not work (the custom search engine does work, and it is not the topic).
<?php
include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php');
if (isset($_POST['searchswitchersubmit'])) {
if ($_POST['searchswitcherradio']=='database') {
return $modx->runSnippet("sgpidbsearch",array(
"search"=>$_POST['searchtext']
));
}
if ($_POST['searchswitcherradio']=='website') {
return $modx->runSnippet("AjaxSearch",array(
"ajaxSearch"=>'0'
,"landingPage"=>'42'
,'advSearch'=>'allword'
,"search"=>$_POST['searchtext']
));
}
}
?>
<html>
<form id="searchswitcher" action="<?php echo $_SERVER['php_self']?>" class="searchswitcher" method="POST">
<span class="searchtext">Quick search here: </span> <input type="text" size="" name="searchtext" /><br />
<input type="radio" name="searchswitcherradio" value="database" checked="checked"> in database
<input type="radio" name="searchswitcherradio" value="website"> in website
<input type="submit" name="searchswitchersubmit" value="Search" />
</form>
</html>
Do you have any idea where my fault is?
Thanks ahead.