Jump to content

Topic on Skin talk:Erudite

Search Box Location

4
147.202.201.4 (talkcontribs)

I don't instictively look at the bottom of a page for a search box. The upper right corner is, I think, the more appropriate location. Is there any way to change the location of the search box?

Dea-Renate (talkcontribs)

Unsure about bumping etiquette here, but I just added a quick fix for that on my Wiki. Just add the following at line 84 at Erudite.skin.php:

			?>
				<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform">
					<input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>" />
					<div>
						<?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>
			<?php

This doesn't remove the one at the footer (I didn't think it necessary), but it's easily removable at (around) line 150 in the same file.

Quick73 (talkcontribs)
Great floors (talkcontribs)

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)

Reply to "Search Box Location"