0

I am maintaining a Drupal 7 site that was developed by another developer and I'm trying to move the search field on the results page to appear under the H1. Currently the site has a search field that appears at the very top (above the top navigation) > after the user submits a keyword in the search field, they are taken to the Results page which has a second search field that appears right above the H1.

I know that the second search field on the Results page is within the $content['main'], but I can't seem to locate how to move the search field to save my life! The script in the template.tpl.php file that contains the $content['main'] is pasted below. I've checked the MySQL database (field_revision, field_data, & node tables), Structure (Panels, Mini Panels, Views, Pages, & Blocks), and content types -- all to no avail.

<?php if (!empty($content['main'])): ?>
<?php print render($content['main']); ?>

<? // debugging  ?>
<pre><?php print_r($node); ?></pre>
<?php
print '<div>var_dump <br/>';
var_dump($content); 
print '</div>';
?>
<? // debugging  ?>

Output from debugging script that was pasted below the $content['main']

var_dump
array(5) { ["search"]=> string(798) " 

" ["header"]=> string(0) "" ["main"]=> string(4492) "

I've looked into Where does Drupal store the content of a node's body? but haven't found the search field in any of the suggestion yet.

1
  • Welcome to Drupal Answers! In which function / template file are you using that code?
    – apaderno
    Aug 9, 2013 at 19:14

1 Answer 1

0

The header normally comes from the page, and the search field comes from the form. In order to place the h1 under the search field I'm usually using the next steps:

  1. Hide the title on the search results page using the theme_preprocess_page
  2. Use the search-results.tpl.php to insert the title under the search field
1
  • @kiamlaluno, Thank u 4 taking the time 2 help me. Sorry 4 the delay, I've been trying 2 figure this out the past week. The search field circled in red (i199.photobucket.com/albums/aa1/ivanc_1/…) is the 2nd search box that appears only on the Results page & the one to remove. I was able to add another search field under the H1 (appears in gss-results.tpl.php), but haven't found where the 2nd is called in $content['main'] (sites>all>themes>[theme name]>plugins>layout>[theme-name]-template.tpl.php). Site uses Google Site Search module.
    – ForTheWin
    Aug 15, 2013 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.