Please upgrade here. These earlier versions are no longer being updated and have security issues.

Adding An Attribute To Search

XarcellXarcell North Carolina

I'm going through the template code and cannot find HTML where I can add the "placeholder" attribute to the forum search. I want to change this:

<input type="text" id="Form_Search" name="Search" value="" class="InputBox">

to this:

<input type="text" id="Form_Search" name="Search" value="" placeholder="Search Forum!" class="InputBox">

Tagged:

Comments

  • TamaTama United Kingdom ✭✭✭
    edited August 2013

    Quick tip, visit https://github.com/vanillaforums/Garden/find/master and enter the term "search". Upon finding the the correct file from views, in this case applications/dashboard/views/search/index.php and `` I would copy it to mytheme/views/search and make the changes needed.
    Oops applies to a different page, but looks like you can use Smarty tags.

  • hgtonighthgtonight ∞ · New Moderator

    What version of Vanilla are you running?

    Are you referring to the default theme, or something else?

    Assuming you are using a theme with a default.master.tpl file that uses the smarty tag {searchbox} you can add $Definition['Search'] = 'My other placeholder text'; to your /conf/locale.php file.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • XarcellXarcell North Carolina

    @hgtonight said:
    What version of Vanilla are you running?

    Are you referring to the default theme, or something else?

    Assuming you are using a theme with a default.master.tpl file that uses the smarty tag {searchbox} you can add $Definition['Search'] = 'My other placeholder text'; to your /conf/locale.php file.

    I'm using a custom theme I made, and vanilla 2.0.18.8. I see no tpl files. I see the default.master.php file though. I also see this within it:

                <div class="Search">
                  <?php
                      $Form = Gdn::Factory('Form');
                      $Form->InputPrefix = '';
                      echo 
                          $Form->Open(array('action' => Url('/search'), 'method' => 'get')),
                          $Form->TextBox('Search'),
                          $Form->Button('Go', array('Name' => '')),
                          $Form->Close();
                  ?>
                      <div style='clear:both;'/>
                 </div>
    
  • XarcellXarcell North Carolina

    That worked great, thanks.

Sign In or Register to comment.