Search box in the header of a template

Permalink
Hi,

I've looked around trying to find a simple solution to this but not had much luck!

Does anyone know the code to put in the header.php file of my template so i get a search box on the site. I would also like this search box's results to link to another results page?

Any ideas anyone? thanks for looking!

 
12345j replied on at Permalink Reply
12345j
this functionality is included in the search block and you have the option with it to post results to a seperate page.
obaluba replied on at Permalink Reply
thanks for your reply.

How do I get the search input box in the header on each page on the site?
12345j replied on at Permalink Reply
12345j
for current pages you can't but for new pages you ccan. go to dashboard, themes, page types, and next to the page types you want to modify click on defaults.
obaluba replied on at Permalink Reply
so its not possible to take the search input box and put it in my header and for it to return results onto another page? I want the search box hardcoded into the actual template not in a block as such

Thanks for your replies so far!
12345j replied on at Permalink Reply
12345j
you could try with forms, don't know if itll work though.
Shotster replied on at Permalink Reply
Shotster
> so its not possible to take the search input
> box and put it in my header

Of course it is. You can hard code a block into your template, but the way I did it was to add a search block to the global scrapbook and then incorporate it into my header.php view template as follows...

<div class="search"><?php
   $b = Block::getByName('Site Search Field');
   if( is_object($b) ) $b->display(); ?>
</div>

> and for it to return results onto another page?

That's an option in the search block configuration dialog.

-Steve
obaluba replied on at Permalink Reply
Thanks for your replies.

So if I create a search block add it to my global scrapbook then add the above code into my header it should work?

Thanks again
12345j replied on at Permalink Reply
12345j
yeah that should work
obaluba replied on at Permalink Reply
I've managed to add this now, thanks for that code.

How do I change the styling of the search box.

I would like to get rid of the Search Title and add some CSS styling to the input box?

thanks for looking
jbx replied on at Permalink Reply
jbx
jbx replied on at Permalink Reply
jbx
Actually, just read through the page and it actually just tells you what custom templates are, not how to build them. My bad...

This is a slightly better link:
http://www.concrete5.org/documentation/developers/blocks/directory-...

In summary though - copy the /concrete/blocks/search folder to /blocks/search and you can then update the view.php file and the view.css file. Or create a completely new skin under blocks/search/templates/skin_name.php

Jon
Fernandos replied on at Permalink Reply
Fernandos
Simply add this into the place in the header.php where you want your search block.
<div id="my_search_block_id_or_whatever">
<?php 
$sb = new Area('Search Block');
$sb->display($c);
?>
</div>


Then simply add the search block from within Concrete5's "edit mode". That's all!