TinyPortal

Development => Block Codes => Topic started by: Lord Anubis on March 24, 2007, 04:16:24 AM

Title: Firefox Search Extension
Post by: Lord Anubis on March 24, 2007, 04:16:24 AM
Tired of having to ask your members to use the search?  Using this they can always search your forum from Firefox, this will install a search for your forum within Firefox :up:

A live demo can be seen here (http://nextsite.org) on the left column under services.

1.  You need to create a source file, telling Firefox how to search your forum.

<search
     version="7.1"
     name="Yoursite Search"
     description="Search Forum"
     action="http://yoursite.com/index.php"
     target="_blank"
     method="GET"
     update="http://yoursite.com/forumsearch.src"
     updateCheckDays="5"
>

<input name="action=search2;search=" user>

<BROWSER
     update="http://yoursite.com/forumsearch.src"
     updateIcon="http://yoursite.com/forumsearch.png"
     updateCheckDays="5"
>


To create this file for your forum, copy the code above and save it to a text file named forumsearch.src. Replace http://yoursite.com with the url of your forum.

2. Find or Create a .png image that is 16X16 to appear on the search area on Firefox.
  Here's a basic image to use (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fcommunity.attac.at%2Ffileadmin%2Fchc-forum-templates%2Fimg%2Fsearch.png&hash=16025cded70b6d777fe005894695410477346394)
Save this image as forumsearch.png and upload this image and the forumsearch.src to the root directory of your forum.

3. Now you need to create a javascript file

function addEngine(name,ext,cat){
     if ((typeof window.sidebar == "object")
          && (typeof  window.sidebar.addSearchEngine == "function"))
     {
          window.sidebar.addSearchEngine("http://yoursite.com/" + name + ".src",
          "http://yoursite.com/" + name + "." + ext, name, cat );
     } else {
          //you could put an error handler here;
     }
}


Of course change http://yoursite.com to the url of your forum
Save this file as forumsearch.js and upload this to the root of your forum

Finally, where Tinyportal comes into play  ;)

Create a scriptbox and add this
<center><script language=JavaScript src="/forumsearch.js"></script>
<a href="javascript:addEngine('forumsearch', 'png', 'Yoursite Search')">
Install Firefox Search Extension</a></center>


You can dress this up a bit and add an image with this code

<center><script language=JavaScript src="/forumsearch.js"></script>
<a href="javascript:addEngine('forumsearch', 'png', 'Yoursite Search')"><img src = http://yoursite.com/Firefox.gif></img><br>
Install Firefox Search Extension</a></center>