Currently, the title on results page is per what we have entered in title field in finder settings page. It would be really nice if we can change it to show the searched keywords, for example:
Instead of Finder 1...

Change it to:
Search results for "keyword 1" "keyword 2"...

Is this possible?

Comments

danielb’s picture

Category: feature » support

You can override theme_finder_results and within it use drupal_set_title() to change the title based on this variable:

 * @param $keywords
 *   An array keyed by finder_element_id, where the values are any
 *   str/num/bool/null or an array of such values to be OR'd together.
 *   This is provided so themers can reformat the keywords and output them back
 *   to the user.

I don't wish to develop or maintain a one-size-fits-all solution with something like this, unless someone can come up with a really simple to maintain patch where perhaps the burden to configure this correctly is on the user not on finder.

deanloh’s picture

Thank you Daniel for the quick response.

If it's not too much of me to ask... can I trouble you to show me an example of codes for overriding the title? The only thing I know is I need to edit template.php, but how to do it I'm completely clueless. I'll buy you beer.

danielb’s picture

Status: Active » Fixed

Well you'd probably use placeholders like

drupal_set_title(t('Search results for "%words"', array('%words' => implode('" "', $words))))

Of course you will have to assemble the $words array based on $keywords, and that will be the tricky part because the structure of $keywords will depend on your finder. You could probably also use post values to get the data.

And you'll need to know how to theme to be able to do this, which is not something specific to finder.

My advice is if you feel completely clueless then... don't do this. If you want a great site that works exactly how you want, then you have to have the skills to tweak it, or hire someone that does. If you want to build a site easily without being a developer, then you just have to live with the basic features.

Status: Fixed » Closed (fixed)

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