I'm using the Interlaced theme, and I want put a search at the top in the "primary links" section. But the theme isn't setup like others. It doesn't have page.tpl.php etc. It has "interlaced.theme". And the php code is different. This is confusing for a noob like me.

Can someone please tell me what I need to change - and to what?

$output .= '<table style="width: 100%; vertical-align: top;" cellspacing="0" cellpadding="0">

  <tr>
    <td style="vertical-align: top;" class="headersitename">
      ';
  $output .= theme_get_setting('toggle_name') ? variable_get("site_name", "drupal") : '';
  $output .= '
    </td>
  </tr>
	
  ';

  $primary_links = theme('links', menu_primary_links());
  if ($primary_links) {
    $output .= '<tr>
    <td class="headerlinks">
      '. $primary_links .'
    </td>
  </tr>
		
  ';
  }

Comments

.carey’s picture

So there is an awesome PHP geek here that can help me put search in the top menu of this theme?

dgp’s picture

I've customized interlaced.theme beyond recognition--it's pretty easy. Don't be afraid.

$output .= 'xx' means "APPEND 'xx' onto the end of the variable '$output'. Just about all of the statements in a .theme are like this.

So all you have to do is make your own. I've edited the code you posted with an example:

$output .= '<table style="width: 100%; vertical-align: top;" cellspacing="0" cellpadding="0">

<tr>
<td style="vertical-align: top;" class="headersitename">
';
$output .= theme_get_setting('toggle_name') ? variable_get("site_name", "drupal") : '';
$output .= '
</td>
</tr>

';

// YOU will have to figure out what to put here. I used the built-in search block so I haven't hard-coded a drupal search field before. This is just an example.
$searchform = '<form action="????"><input type="text" name="????" /><input type="submit" value="Search" /></form>'

// Below we've added in $searchform which will display the search field after your primary links...
// You will need some cool CSS to make the form not look totally heinous in that location.
$primary_links = theme('links', menu_primary_links());
if ($primary_links) {
$output .= '<tr>
<td class="headerlinks">
'. $primary_links . $searchform .'
</td>
</tr>

';
}
.carey’s picture

Interesting! I had tried this:

$output .= '<tr>
<td class="headerlinks">
'. $primary_links . $search_box .'
</td>
</tr>
';

You know, I figured from this: <?php print $search_box ?> But I didn't define it ($searchform = '<form action="????"> ...). And, of course, it didn't work.

So, when I didn't get a response to my post I converted interlaced.theme over to use page.tpl.php etc. using Bluemarine as a guide. And then inserted $search_box. Viola!

In the long run, with all the customizing I am doing, and with more than one site, the conversion has benefited greatly. But I sure do wish I knew PHP. Just haven't been able to wrap my head around it yet.

Many thanks for teaching me something. ;)