Determine if the current Drupal page is a search results page?
How can I开发者_StackOverflow社区 determine if the current Drupal page is a search results page?
Assuming clean URLs are on, this usually works
function MYTHEME_preprocess_page (&$vars, $hook) {
// ...
if ($hook == 'page' && arg(0) == 'search') {
// do search related stuff
}
}
inside your template.php
.
Normal template suggestions work, too, such as using a page-search.tpl.php
instead of page.tpl.php
if that is also needed.
精彩评论