Hi,
I'm trying to display the Views Fast Search search box on my front page (and other non-views pages).
In views I enabled views_fastsearch and made it a block, but when I insert the block into a region it doesn't display anything.
How do I search using Views Fast Search when not on a views page? Ideally I'd like to insert it across all pages as a block. Any assistance is appreciated.
Thanks,
Michael
Comments
Comment #1
jimmb commentedI'm trying to do the same thing, only with a view that's also set up as a page. The exposed filter is the search element, which you can see here: http://mcbw.sundaysenergy.org/mnservicessearch
I believe it should be possible to have a page view of search results, but to have the search function be both on a page and a separate block..... If so, I'll be glad to hear the answer! Right now, when I try to set it up I get the same result that burtrito mentions.
Thanks,
Jim
Comment #2
allie mickaI got this to work by overriding the standard search block's form:
This will grab the search block form as it goes by, updating its URL and parameters to point to my view instead. Besure to replace "directory_search" with the URL of your search view.
Comment #3
burtrito commentedHi Allie,
Add that code to my theme's Template.php file?
Do I need to change anything else other than 'directory_search' ?
Thanks,
Mike
Comment #4
dejbar commentedGiven that a block is actually created that doesn't work I think this should be regarded as a bug instead of a support request. Perhaps if the documentation explained that you shouldn't expect the generated block to work this would become a feature request.
As for Allie's solution. I tried adding this function to template.php renaming it from 'mymodule_form_alter' to 'theme_form_alter' (this has appeared to work in the past) but there was no effect. Is this how it was expected to be used? I think that most people who don't know how to solve this problem probably won't know what to do with that code.
Comment #5
doc2@drupalfr.org commentedAllie, mogtofu, could you explain a bit more what to change and where?
The question is about overriding the search bar which appears at the top right corner. I guess this is not about adding a block. But if we need such a block to use its form elements, where all of that will go?
Many thanks people!
Comment #6
mogtofu commentedAnother simple way is just to create a new block, and using full html format you make your own little form :
Comment #7
mroswell commentedmogtofu, thanjks for a terrific solution. I offer one amendment: I added a forward slash before the search/fast in the form tag.
Comment #8
doc2@drupalfr.org commentedMarking as duplicate of: #189531: Redirect the standard search box to the views_fastsearch page?
The custom defaultsearch.module solution worked for me! Very easy indeed!