Override HTML title tag in views fast search
PeterZ - August 23, 2008 - 03:24
| Project: | Views Fast Search |
| Version: | 5.x-2.0 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'd like to access values from the views fast search form to set the views fast search HTML title tag (not the drupal title field).
It doesn't seem that I can access those fields with php from within the views header field where I've tried things like:
<?php
$name = drupal_get_title();
drupal_set_title($form['filter0']['#value'])
?>It also doesn't seem like I can correctly override the $title tag in page.tpl.php where I've tried replacing:
<?php
print $head_title
?>with things like:
<?php
print $form['filter0']['#value']
?>It's likely my ineptness with PHP and drupal coding that is causing my difficulties.
Would greatly appreciate any clues.
Great module...I'm finding it really, really useful.
Thanks!

#1
Hello PeterZ,
I was investigating a lot in the subject and finally came bak to the source, I've added the following code in my fastsearch module, as a workaround until final solution. This affect all the fastsearch views
after line 272
// NOTE: using global to pass values to theme_views_fastsearch_displayglobal $_vfs_search_keys;
$_vfs_search_keys = $values;
I have added:
drupal_set_html_head('<h1>' . implode(" ",$values[$op]) . ' - ' . check_plain(t(drupal_get_title())) . '</h1>' );you can see results here or here
The results is an h1 title at the begging of the page.
At this time I have tested also "drupal_set_title" instead of "drupal_set_html_head", but doesn't work. Seems that title is "all set" at the moment this piece of code run.
If you preffer not to modify the module, you may add the same piece of code in each view title or footer using the global var $_vfs_search_keys instead of $values array filtered as a php code (not tested!)
<?phpecho '<h1>' . implode(" ",$_vfs_search_keys[$op]) . ' - ' . check_plain(t(drupal_get_title())) . '</h1>' ;
?>
regards, Gustavo