Wildcat Media
Well-known member
In order to get the Chrome "tab to search" feature working, and apparently to do similar in other browsers which support it, I'm attempting to add OpenSearch to XF.
But I've hit a snag. What I know about XML wouldn't fit into a mosquito's antennae.
From another thread here, I figured out I can do searches via GET by doing the following:
I can put that into my address bar and the search actually works fine.
It's when I get to the XML portion that I hit a snag. First, let me show you how easy it apparently is to implement OpenSearch into a page/site/whatever. This is as simple as adding a file and making one tiny template edit.
First, you need to create a proper XML document. I named mine opensearch.xml.
Then, you insert a "link rel" tag into the <head> of your document (in this case, you can add it in the PAGE_CONTAINER template):
And that is supposed to work.
However, it seems there is a hiccup in XML. When I try loading the page in the forum, there is no change. If I click on the /opensearch.xml file when I view the page source, Chrome complains about invalid XML.
Running through a validation gives me the following:
In essence, it's the word "keywords" that must be a reserved word in XML which I cannot use.
If I can get past that, perhaps this might start working. Is anyone here familiar enough with XML that might know a workaround or edit that would make this XML pass validation?
But I've hit a snag. What I know about XML wouldn't fit into a mosquito's antennae.
From another thread here, I figured out I can do searches via GET by doing the following:
Code:
http://forums.xyz.com/index.php?search/search&keywords=my%20search%20term%20here
I can put that into my address bar and the search actually works fine.
It's when I get to the XML portion that I hit a snag. First, let me show you how easy it apparently is to implement OpenSearch into a page/site/whatever. This is as simple as adding a file and making one tiny template edit.
First, you need to create a proper XML document. I named mine opensearch.xml.
Code:
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>XYZ Forum</ShortName>
<LongName>Search XYZ Forum</LongName>
<Description>Search the XYZ Forums</Description>
<Developer>Joe Developer</Developer>
<Attribution>Copyright Joe Developer, Inc.</Attribution>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
<InputEncoding>UTF-8</InputEncoding>
<OutputEncoding>UTF-8</OutputEncoding>
<Image width="16" height="16" type="image/x-icon">http://www.xyzforum.com/favicon.ico</Image>
<Url type="text/html" method="GET" template="http://forums.xyz.com/index.php?search/search&keywords={searchTerms}"/>
</OpenSearchDescription>
Then, you insert a "link rel" tag into the <head> of your document (in this case, you can add it in the PAGE_CONTAINER template):
Code:
<link rel="search" type="application/opensearchdescription+xml" title="XYZ Forums" href="/opensearch.xml" />
And that is supposed to work.
However, it seems there is a hiccup in XML. When I try loading the page in the forum, there is no change. If I click on the /opensearch.xml file when I view the page source, Chrome complains about invalid XML.
Running through a validation gives me the following:
In essence, it's the word "keywords" that must be a reserved word in XML which I cannot use.
If I can get past that, perhaps this might start working. Is anyone here familiar enough with XML that might know a workaround or edit that would make this XML pass validation?