To get the positioning perfect, copy the search box code from the bottom footer, then add it in as a list item after the autogenerated list items. Then go to erudite.css and in the #menu li:last-child section add the line "float: right;".
The search box will be perfectly in line with the menu items except that it will be on the right edge of the screen.
Here's my php code, but be aware that it includes a potential error but I can't be bothered fixing it because it will never affect me - and probably nobody else either. Namely, the menu list is opened (<ul> etc.) *if* there are menu items. My code then includes a new menu item and closes the menu list, but my code never checked if the menu list was opened. For me, I know there will always be menu items, so I know the list will always get opened, so I don't care about this potential error. Would be easy to fix but I'm working to a deadline...
I'm including all the code from line 74 onwards for context in case the line numbers have changed in later versions. I'm working on REL1_25.
<div id="nav" role="navigation">
<?php
if( array_key_exists( 'navigation', $this->data['sidebar'] ) ) {
echo "<ul id='menu'>\n";
foreach( $this->data['sidebar']['navigation'] as $item ) {
printf( '<li id="menu-item-%s">', Sanitizer::escapeId( $item['id'] ) );
printf( '<a href="%s">%s</a>', htmlspecialchars( $item['href'] ), htmlspecialchars( $item['text'] ) );
echo "</li>\n";
}
}
?>
<li>
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform">
<input type='hidden' name="title" value="<?php $this->text( 'search' ) ?>" />
<div style="float: right;">
<?php echo $this->makeSearchInput( array( 'type' => 'text', 'id' => 's' ) ); ?>
<?php echo $this->makeSearchButton( 'go', array(
'value' => $this->translator->translate( 'searchbutton' ),
'class' => "searchButton",
'id' => "searchsubmit",
) ); ?>
</div>
</form>
</li>
</ul>
</div>
. Great floors (talk) 16:17, 1 May 2017 (UTC)