Topic on Project:Support desk

Jump to navigation Jump to search

Default Value "Search" in Search Box (Vector)

Pdcemulator (talkcontribs)


in Mediawiki and Wikipedia Website using Vector skin there ist a default value "Search" in Search Box. How I can add this default text in mi Wiki (MW 1.16, Vector)? My Searchbox is empty, but with Search Text inside it would be more easy for users.

Sorry for my poor English.

MediaWiki 1.16.0 PHP 5.2.14 (cgi-fcgi) MySQL 5.1.53-community Its a private Wiki, so I cant provide an URL.


晒太阳的冰 (talkcontribs)

Same question!

I want to know, too!

Unifiedrepublic (talkcontribs)

It looks like it's only coded to display the search terms for something already searched on. However, using the Special:SystemMessages tool, you could define your own message and replace the value to be:

<?php $this->msg( 'CUSTOM_MESSAGE' ) ?>

where CUSTOM_MESSAGE is your own defined message on line 750 where it's currently:

<?php $this->text( 'search' ) ?>

Though in actuality, it might be better, rather than hardcoding the changes in the template, to use jQuery to populate that value with whatever you want and use an onClick handler to blank it so they can enter what they want rather than having to backspace it. It might be a better UI. And you can update the skin with the latest releases with just this one bit of JavaScript rather than have to merge PHP changes.

Krinkle (talkcontribs)

This enhancement, among other nice features, is part of the Extension written for the Vector-skin (Extension:Vector). It is written recently and requires MediaWiki 1.17. Although 1.17 isn't officially stable yet, Wikipedia is currently running it on all wikis.

If you decide to upgrade to 1.17, be sure to keep up with updates and make sure you make backups before every update. Upgrading to 1.17 is not yet recommended for large/production sites.

Unifiedrepublic (talkcontribs)

Probably the better idea, rather than branching your own version of Vector and having to maintain it if you can wait until the 1.17 version is stable.

Reply to "Default Value "Search" in Search Box (Vector)"