Restore search page

Permalink
My employer didn't want the search page in the nav. At the time I didn't know any way to do that but to delete the page, thinking that it would be easy to make a new one should it be needed. I should have used the 'exclude from nav' attribute. Now I'm beginning to suspect that it is a single page with a custom header.



If I add a search block to the header and direct the output to a normal page, the search results show both in the header and on the page.



On IRC I got this link:http://www.concrete5.org/documentation/how-tos/editors/restore-a-de...



But I don't know what the search page is called, if it even is a single page. If I just type in 'search' it says 'That specified path doesn?t appear to be a valid static page.'

 
katiam replied on at Permalink Reply
Hi,

I am not sure if there is a setting in c5 to fix this, but I have a work-around.
What is happening is the search function seems designed to display results if a search query is being posted, it doesn't understand that it is in the header and shouldn't list results there.

1. Copy the ouputted HTML from the search block which in your header
2. Delete the search block from the header
3. Paste the HTML in the header in your template instead
4. In the form HTML, where it says "action" replace the hardcoded path (eg: '/home/sitedirectory') with the following: <?php echo View::url('/'); ?>

You'll end up with some HTML along the lines of:

<form id="search" action="<?php echo View::url('/'); ?>index.php/!trash/search-results/" method="get" >
<input name="search_paths[]" type="hidden" value="" />
<p>
<input type="text" name="query" value="Search..." onfocus="if(this.value=='Search...') this.value=''" onblur="if(this.value=='') this.value='Search...'"/>
</p>
<p><input type="submit" name="submit" value="" class="search-bt"/></p>
</form>

Hope this helps.
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
I've done the same with a little trick of css. Just put a css class for header search block & find the search result container div. The put a css like below:
#header .search_result{display:none !important}


So it hides the result from header but doesn't affect the main search result page.

Rony