Last updated November 12, 2011. Created by danielb on July 25, 2011.
Log in to edit this page.

Using PHP

The simplest way to embed a finder with PHP is to enable the 'provide block' option and use code like so:

<?php
print theme('block', finder_block('view', 'finder_X'));
?>

Where X is the finder id integer (which you can figure out from the URL of the admin pages).

If you need more control than this, consider looking into the functions: finder_view(), theme('finder_page'), or theme('finder_block'). You should also check user_access('use finder'); to see if the user has permission to use the finder in these cases, as it is not done automatically like when you embed the block.

If you are embedding a finder into your page.tpl.php file, please be aware that it is much easier to just create a new block region in your template and use the UI to put a finder block there. The reason is that autocomplete finders need a bit of extra work to get them working when embedded in a tpl file, because the JavaScript file will be missing.

Embed finder into a node

If you want to easily embed a finder in a node, try the Block reference module.

Resources

More discussion about embedding finders here:
#1214082: Replace core search with a fancy Finder form
#1086360: Autocomplete suggestions not showing up when manually printing with finder_view
#1072020: Embed Finder in other websites
#582276: Embed Finder form in node?

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

I am trying to embed finder into a mega menu (using muchomenu). Technically the menu is a block so I'm trying to embed finder block into another block. I'm using the code you mention here but the only rendered output I get is this

<div id="block--" class="">
  <div class="content">
  </div>
</div><!-- /.block -->

I could be wrong but it looks like its failing at finder_block(). I am using finder_1 for the first finder in the list. Block is enabled, permissions are ok. I'm really not sure what else I need to do to make this work.

Any help would be appreciated.

the finder_block. Did´nt work for me. I did:

$block = module_invoke("finder", "block", "view", "finder_7");
print ($block["content"]);