<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blue Flex &#187; openSearch</title>
	<atom:link href="http://kennethsutherland.com/tag/opensearch/feed/" rel="self" type="application/rss+xml" />
	<link>http://kennethsutherland.com</link>
	<description>Flex with a hint of cool</description>
	<lastBuildDate>Wed, 28 Sep 2011 14:12:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>A &#8211; Z, custom search to firefox plugin</title>
		<link>http://kennethsutherland.com/2009/05/11/a-z-custom-search-to-firefox-plugin/</link>
		<comments>http://kennethsutherland.com/2009/05/11/a-z-custom-search-to-firefox-plugin/#comments</comments>
		<pubDate>Mon, 11 May 2009 13:26:04 +0000</pubDate>
		<dc:creator>Kenneth</dc:creator>
				<category><![CDATA[firefox]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[custom search]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[openSearch]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://kennethsutherland.com/?p=283</guid>
		<description><![CDATA[So you may have read my previous posts on the custom search that I created, well as suggested in a previous comment the information to create one then turn it into a open search search plugin and then into a firefox plugin is out there.  It&#8217;s just not all in the same place. So I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>So you may have read my previous posts on the custom search that I created, well as suggested in a previous comment the information to create one then turn it into a open search search plugin and then into a firefox plugin is out there.  It&#8217;s just not all in the same place.</p>
<p>So I&#8217;m going to go through the process and try to make clear each step of the way. Here is what I&#8217;m going to cover.</p>
<ol>
<li>Create the custom search (hosted by Google)</li>
<li>Take new custom search and insert into wordpress</li>
<li>Create a OpenSearch plugin from code that’s compatible with the majority of browsers</li>
<li>Turn OpenSearch plugin into a firefox plugin so that you can list it under firefoxes search plugins</li>
<li>Make the browser automatically pick up the openSearch plugin to show user you have plugin available</li>
</ol>
<p>So first you need to create the search.</p>
<h4>1, Create Google custom search.</h4>
<p>For this (AFAIK) you need a Google account and you then need to get a adSense account set up.  This is how I found the custom search as it is part of the options on the general screen.  I kind of expect that this option to create a custom search will be available elsewhere on the Google site but this is where I found it.</p>
<p><img class="aligncenter" title="Google adsense" src="/images/adsense.png" alt="" width="600" height="233" /></p>
<p>Once you go through the wizard that Google gives you, you get a choice.  I&#8217;ve gone with opening the result inside Google.  If you choose the last option then the end result will mean that you will get two bits of code to insert into your wordpress site. If this is the case then I&#8217;d have a look at a wordpress plugin to deal with the code. There are a few out there, but they may or may not work depending on your theme that you have.</p>
<p> </p>
<p><img class="aligncenter" title="google choice for adsense" src="/images/adsenseSearch.png" alt="" width="600" height="153" /></p>
<p>I choose the hosted on Google option because &#8211; 1, should it (the search) be popular then it will not increase my bandwidth usage and 2, it makes it more offical if its hosted on a  google URL (just my opinion).</p>
<p>You should now have some code from Google, something along the following lines</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form action=&quot;http://www.google.com/cse&quot; id=&quot;cse-search-box&quot;&gt;
  &lt;div&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;cx&quot; value=&quot;partner-pub-7396620608505330:xjbbr6-w0cu&quot; /&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;ie&quot; value=&quot;ISO-8859-1&quot; /&gt;
    &lt;input type=&quot;text&quot; name=&quot;q&quot; size=&quot;23&quot; /&gt;
    &lt;input type=&quot;submit&quot; name=&quot;sa&quot; value=&quot;Search&quot; /&gt;
&nbsp;
  &lt;/div&gt;
&lt;/form&gt;
&nbsp;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/coop/cse/brand?form=cse-search-box&amp;amp;lang=en&quot;&gt;&lt;/script&gt;</pre></div></div>

<p> </p>
<h4>2, Insert code into wordpress</h4>
<p>Now that you have your code you will need to find the searchform.php file from your theme. Should be inside wp-content-&gt;themes-&gt;{your theme} -&gt; searchform.php</p>
<p>Open up that file and insert the new code.</p>
<p>I didn&#8217;t do anything to the Google code, just pasted it above the standard wordpress code so I now have 2 searchs on my site, one for the &#8216;Flex collection&#8217; and one for my site.</p>
<p>Thats it, part 2 done.</p>
<h4>3, Create OpenSearch plugin</h4>
<p>First you need to get a URL that you can use for your search. So either do a search after installing your search in your wordpress blog or look at the code and put it all together to create one.</p>
<p>For example if you do a search on my site for &#8216;pie charts&#8217;, this is the URL that you end up with <a title="search example" href="http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1&amp;q=pie+charts&amp;sa=Search+-+Flex+Collection" target="_blank">http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1&amp;q=pie+charts&amp;sa=Search+-+Flex+Collection</a>  </p>
<p>If you look at the above code from point 2 you&#8217;ll be able to see how its made up.</p>
<p>Now that you have a URL go to <a title="Opensearch plugin" href="http://mycroft.mozdev.org/" target="_blank">http://mycroft.mozdev.org/</a> and select to create a plugin.</p>
<p>Fill in all the boxes (they&#8217;re all pretty much self explanatory), but as an example the two main inputs that have to be correct are the &#8216;Search URL&#8217; and the &#8216;Search Form URL&#8217;</p>
<p>Using the above URL, my &#8216;Search URL&#8217; would be <a title="search example" href="http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1&amp;q=pie+charts&amp;sa=Search+-+Flex+Collection" target="_blank">http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1&amp;q={searchTerms}&amp;sa=Search+-+Flex+Collection</a> </p>
<p>and the &#8216;Search Form URL&#8217; would be <a title="blank search" href="http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1" target="_blank">http://www.google.com/cse?cx=partner-pub-7396620608505330%3Axjbbr6-w0cu&amp;ie=ISO-8859-1</a></p>
<p>Click &#8216;Generate Code&#8217; then &#8216;Install Plugin&#8217;. Test the plugin and if all is good (copy the generated code), then submit plugin.</p>
<p>Take note of the URL that you can use to get at the plugin from mycroft.mozdev.org, you will need this for part 5.</p>
<h4>4, Create firefox plugin</h4>
<p>Take your code that you just copied from part 3 and save it to a XML file.</p>
<p>Open <a title="Firefox plugin" href="https://addons.mozilla.org/en-US/firefox" target="_blank">https://addons.mozilla.org/en-US/firefox</a></p>
<p>Login/register -&gt; developers tools -&gt; submit add-on.</p>
<p>Pick a licence, then it will ask you to upload a file. Upload the XML file that you just saved. Then its just a case of editing the appropriate sections and you are now done.</p>
<p>Do a quick search for your plugin and you can now get a URL such as <a title="Plugin page" href="https://addons.mozilla.org/en-US/firefox/addon/11823" target="_blank">https://addons.mozilla.org/en-US/firefox/addon/11823</a> and send this round friends etc to get some reviews. Once you have a few reviews you can submit your plugin to be made public.</p>
<p>Feel free to review my plugin, I need some reviews so that I can submit it.</p>
<p>Finally.</p>
<h4>5, Make the browser pick up the openSearch plugin when your site is viewed</h4>
<p><img class="aligncenter" title="auto pick up of openSearch" src="/images/openSearchAuto2.png" alt="" width="600" height="142" /><br />
The above image shows what happens if a browser picks up that the site it is displaying has a custom search tool that can be installed.  It highlights a small button beside the search box.<br />
To do this I&#8217;ve placed the following code into the header file</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; title=&quot;Flex Collection&quot; href=&quot;http://mycroft.mozdev.org/installos.php/30790/fx.xml&quot;/&gt;</pre></div></div>

<p>Use the above but replace the href with whatever URL you saved from part 3 (the mycroft.mozdev link) and obviously replace the title with something relevant to your search.<br />
Then place that line of code into the header.php for your theme (or somewhere that will always get served up on your site, I just choose the header as that seemed appropriate).  Put it beside the other links if your header file has them otherwise just make sure it&#8217;s in the head tag.</p>
<p>That&#8217;s it.<br />
Hope this is helpful.</p>
<p style="text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-7396620608505330";
google_ad_slot = "1277482570";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://kennethsutherland.com/2009/05/11/a-z-custom-search-to-firefox-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

