Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Default Search Method - Advanced

edited September 2008 in Vanilla 1.0 Help
Hey guys,

I'm just wondering whether it's possible to have the advanced search form show up as the default when the search tab is clicked on a forum? At present obviously it's the simple search form that shows as default, but there's just too much whitespace and I'd rather the advanced form displayed as default with the user still being given the option to switch to simple search modes. I'd appreciate any help I could get on this. Many thanks in advance. :)


  • Options
    This may be a help: if ( 'search.php' == $Context->SelfUrl ) { // Add some javascript to the search page that auto-expands the search form if there is an 'Advanced=1' in the URL. $js = ' <script type="text/javascript"> addEvent(window, \'load\', ExpandAdvanced); function addEvent(obj, eventType, fn, useCapture) { if (obj.addEventListener) { obj.addEventListener(eventType, fn, useCapture); return true; } else { if (obj.attachEvent) { var r = obj.attachEvent("on"+eventType, fn); return r; } } } function ExpandAdvanced() { // Get the URL var U = unescape(window.location); if (U.indexOf(\'Advanced\')>-1) { ShowAdvancedSearch(); } } </script>'; $Head->AddString($js); } else { $SearchForm = '<div style="border: 1px 0 solid #ccc"> <form method="get" action="search.php"> <input type="hidden" name="PostBackAction" value="Search" /> <input type="hidden" name="Type" value="Comments" /> <input type="text" name="Keywords" /> <input type="submit" value="'.$Context->GetDefinition('Search').'" /> <a href="'.GetUrl($Configuration, 'search.php', '', '', '', '', 'Advanced=1' ).'">'.$Context->GetDefinition('AdvancedSearch').'</a> </form> </div>'; $Panel->AddString($SearchForm); } }

    You probably don't need that panel string stuff, but the first half adds a script that expands it if you have 'advanced=1' in the URL.
This discussion has been closed.