Monetizing MediaWiki > Advertising + Google + AdSense + MediaWiki >
See also:
Thanks to http://patheticcockroach.blogspot.com/2008/04/google-search-box-in-mediawiki.html
Table of Contents [hide]
Create a file with the code in it ∞
\nano /your_wiki/skins/adsense/adsense_search.php
<form action="http://www.google.ca/cse" id="cse-search-box"> <div> <input type="hidden" name="cx" value="partner-pub-YOUR_CODE_HERE" /> <input type="text" name="q" size="10" <?php echo $skin->tooltipAndAccesskey('search'); if( isset( $this->data['search'] ) ) { ?> value="<?php $this->text('search') ?>"<?php } ?> /> <input type="submit" name="sa" value="Search" /> </div> </form> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script> <small> <span title="How did I do this?" style="border-bottom:1px dotted" id=title> <a href="http://example.com/Hacking_MediaWiki_to_add_a_sidebar_Google_AdSense_Search">[?]</a> </span> </small>
Edit your skin ∞
Remove the old search area ∞
Search for p-search
and remove or comment-out that block of code.
<div id="p-search" class="portlet"> <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5> <div id="searchBody" class="pBody"> <form action="<?php $this->text('searchaction') ?>" id="searchform"><div> <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search'); if( isset( $this->data['search'] ) ) { ?> value="<?php $this->text('search') ?>"<?php } ?> /> <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>" /> <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>" /> </div></form> </div> </div>
Add in the new search box ∞
<?php require("adsense/adsense_search.php"); ?>
Add it wherever you like. For me, I added it above my Google AdSense block, which is above this final block:
<!-- end of the left (by default at least) column -->
Be warned, your MonoBook.php
will be overwritten when you update MediaWiki, so back up this file. Or better yet, re-apply your changes in case they made legit updates to the skin.
What I used for a bit ∞
<google>mediawiki</google> ---- <google>REF</google> ---- <google>WIKI</google>
Notes ∞
-
Google Adsense Search -- was dated at the time, and was deleted 2011-07-29
Last updated 2020-07-06 at 13:00:21