hi there!

I am wondering what is the best way to render a finder-form in the page template. It could use a block - but as the Finder-Form should work like a Search Field, i would prefer putting it in the page.tpl file.

Thanks!
Walter

Comments

danielb’s picture

probably as a block

<?php print finder_view(finder_load(3), 'block'); ?>

or

<?php print theme('finder_block', finder_load(3)); ?>

where 3 is the finder ID.

let me know if there's a problem

danielb’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

valderama’s picture

finally i found time to try this. i works kind of... the finder is printed as wanted, but not working, i guess because the javascript is just included on those pages where the block is actually shown (as configured under admin/build/block)

--- UPDATE: Seems like the only problem is, that the JS and some extras needed for the autocomplete textfield are not loaded on pages, where the "normal" finder-block is not displayed.

is it this check in finder_autocomplete.module ??

line301: if (menu_valid_path(array('link_path' => $element['#autocomplete_path']))) {

---UPDATE2: i can get it work by manually adding the finder_autocomplete.js in template.php -- as the finder should be visible on all pages this seems to be ok. lets see if i forgot something...

in template.php drupal_add_js(drupal_get_path('module', finder_autocomplete) .'/finder_autocomplete.js');

so i am trying to solve, if you have hints they are greatly appreciated :)

thx!
walter

undersound3’s picture

I am printing out a finder instance with autocomplete element in page.tpl.php like so:
<?php print finder_view(finder_load(3), 'block'); ?>

For the autocomplete suggestions box to show up I needed to either:

add the block created by the "Provide block" option
or
add drupal_add_js('misc/autocomplete.js'); to template.php

Why do I need to manualy add this automplete.js file to template.php when I am manualy printing out the finder instance through finder_view?

Thanks in advance for any feedback on this