News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Change search_form position

Started by d3vcho, August 13, 2016, 06:11:54 AM

Previous topic - Next topic

d3vcho

Hi,

I'm doing some stuff to get into the design of themes. Here comes the pain.

I want to place the search_form div next to the main menu. If it's possible, I want the main menu to the left (as in image) and the search form in the right. Is it possible?

Touching a bit of code I obtained this (see attachment). I think I broke up a little bit the layout  :-[. Please be kind, I'm not an expert.
"Greeting Death as an old friend, they departed this life as equals"

glennmckenna

what theme are you running cause all the themes are different (please give us the link, name, and attatch index.template.php)

Antes

Move search code (code should be something like this don't copy/search it) after template_menu();

            <form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
               <input type="text" name="search" value="" class="input_text" />&nbsp;
               <input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
               <input type="hidden" name="advanced" value="0" />';

   // Search within current topic?
   if (!empty($context['current_topic']))
      echo '
               <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
   // If we're on a certain board, limit it to this board.
   elseif (!empty($context['current_board']))
      echo '
               <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

   echo '
            </form>';


Then open your index.css, find #main_menu, remove    width: 98%;, then add this to after it

#search_form {
   float: right;
}

glennmckenna

Quote from: Antes on August 13, 2016, 04:43:35 PM
Move search code (code should be something like this don't copy/search it) after template_menu();

            <form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
               <input type="text" name="search" value="" class="input_text" />&nbsp;
               <input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
               <input type="hidden" name="advanced" value="0" />';

   // Search within current topic?
   if (!empty($context['current_topic']))
      echo '
               <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
   // If we're on a certain board, limit it to this board.
   elseif (!empty($context['current_board']))
      echo '
               <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

   echo '
            </form>';


Then open your index.css, find #main_menu, remove    width: 98%;, then add this to after it

#search_form {
   float: right;
}

as he said
thanks Antes

d3vcho

Thank you Antes. It worked.

Regards.
"Greeting Death as an old friend, they departed this life as equals"

Advertisement: