#1
|
|||
|
|||
Help me create a 2+2 Firefox Search Engine
Using the directions here I'm trying to create a plugin for Firefox to add a 2+2 search to the drop down search menu.
I have a problem with one line of the code, the "input name". Here are the directions for that one line: [ QUOTE ] Next, you need to tell your plug-in what syntax to use when searching for the text you'll type into the Search Bar. This varies from site to site. Again, take a look at the URL that results after you search the site. Look for whatever falls between the first ampersand (& and your search term. For the www.whitehouse.gov site, it is qt. Here's the syntax for this line: <input name="query" user=""> So, in our instance, the line looks like this: <input name="qt" user=""> [/ QUOTE ] The problem is, there is no ampersand (& in the address when I perform a 2+2 search. Anyone know of a way around this? Other than that, it works fine. I got it to show up in the menu with the lightbulb icon but whenever you search for something it just takes you to the search page, looks like this: Here's the code I have so far (the problem line is in red): [ QUOTE ] <search version="7.1" name="2+2" description="A Search Plugin for 2+2 Forums" action="http://forumserver.twoplustwo.com/search.php" searchForm="http://forumserver.twoplustwo.com" method="GET" > <input name="sourceid" value="Mozilla-search"> <font color="red"><input name="query" user=""></font> </search> [/ QUOTE ] |
#2
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
The search runs using dosearch.php with a POST, not a GET. Hence there is no &
I'm not sure if it is possible to make a firefox search if it is a POST, but all the variables are between: <font class="small">Code:</font><hr /><pre><form method="post" action="http://forumserver.twoplustwo.com/dosearch.php"> </pre><hr /> and <font class="small">Code:</font><hr /><pre></form></pre><hr /> in search.php |
#3
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
[ QUOTE ]
The search runs using dosearch.php with a POST, not a GET. Hence there is no & I'm not sure if it is possible to make a firefox search if it is a POST [/ QUOTE ] That won't be necessary. PHP merges POST and GET variables (along with cookies and others) into one namespace for execution. The precedence is dependent on local PHP setup, but since KneeCo will only be sending the variable one way, that won't be a problem. In other words, KneeCo, as long as you get the right variables in this request (pokergrader indicated where to find them in the form) you don't need to worry about variables not being shown in the URL and separated by an ampersand (&. Good luck, let us know how it turns out. |
#4
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
[ QUOTE ]
Using the directions here I'm trying to create a plugin for Firefox to add a 2+2 search to the drop down search menu. I have a problem with one line of the code, the "input name". The problem is, there is no ampersand (& in the address when I perform a 2+2 search. Anyone know of a way around this? Other than that, it works fine. I got it to show up in the menu with the lightbulb icon but whenever you search for something it just takes you to the search page [/ QUOTE ] Always cool to try this stuff out, so I thought I would do some more. There are two basic reasons you are not getting search results: (1) you need to point to the search results page dosearch.php not the form page, search.php, and (2) you need to get the right input variables, especially for the user field. So I took the liberty of doing that. The search plugin follows, with comments in blue: <font class="small">Code:</font><hr /><pre> <font color="blue"># 2+2 Forum Search Plugin for Firefox by KneeCo and StevieG</font> <font color="blue"># comments start with the # sign</font> <font color="blue"># The search tag specifies a name and description for our</font> <font color="blue"># search plugin, and where to go on the Web to peform the</font> <font color="blue"># actual search. We can find the input parameters for the </font> <font color="blue"># search at http://forumserver.twoplustwo.com/search.php</font> <font color="blue"># but the actual page that accepts those inputs and does</font> <font color="blue"># the work is http://forumserver.twoplustwo.com/dosearch.php</font> <font color="blue"># so we make that the action in the search tag.</font> <search version="1.0" name="2+2 Forum Search" description="A Search Plugin for 2+2 Forums" action="http://forumserver.twoplustwo.com/dosearch.php" searchForm="http://forumserver.twoplustwo.com" method="GET" > <font color="blue"># Inside the search tag we specify the inputs for the </font> <font color="blue"># search. These inputs were found by analyzing the search</font> <font color="blue"># form at http://forumserver.twoplustwo.com/search.php</font> <font color="blue"># This is the input for the actual search terms</font> <font color="blue"># and is the only thing the user can enter from the </font> <font color="blue"># plugin:</font> <input name=" Words" user=""> <font color="blue"># This input specifies which forum to search. </font> <font color="blue"># Since the user can only input one thing (the search </font> <font color="blue"># words) we will use a default of All Forums.</font> <input name="Forum[]" value="All_Forums"> <font color="blue"># This section includes the date range information</font> <font color="blue"># the value listed here is to search for anything newer than</font> <font color="blue"># 1 week. This can be changed by changing the value or</font> <font color="blue"># type. Type can be d,w,m, or y for day, week, month, or year,</font> <font color="blue"># respectively.</font> <input name="daterange" value="1"> <input name="newerval" value="1"> <input name="newertype" value="w"> <font color="blue"># If you want to stipulate a search for things older than</font> <font color="blue"># a certain time, then uncomment and use the inputs below</font> <font color="blue"># <input name="olderval" value="3"></font> <font color="blue"># <input name="oldertype" value="d"></font> <font color="blue"># Other inputs </font> <input name="fromsearch" value="1"> <input name="checkwords" value="1"> <input name="where" value="sub"> </search> </pre><hr /> You can save all that in your Program Files\Mozilla Firefox\searchplugins directory as twoplustwo.src to use it. Be sure to save as plain text, no markup for color. I would also grab this image and save it as twoplustwo.png to get an icon in the search pull down. As people have pointed out, though, the 2+2 Forum search does suck, and many people use Google instead. So let's make a Google search for 2+2 specifically. To do this, I modified the existing google.src: <font class="small">Code:</font><hr /><pre> <font color="blue"># Mozilla/Google plug-in by amitp+mozilla@google.com</font> <font color="blue"># Modified by StevieG for search by site</font> <search name="2+2 through Google" description="Google Search of Two Plus Two Forums" method="GET" action="http://www.google.com/search" queryEncoding="utf-8" queryCharset="utf-8" > <input name="q" user> <inputnext name="start" factor="10"> <inputprev name="start" factor="10"> <input name="ie" value="utf-8"> <input name="oe" value="utf-8"> <font color="blue"># this extra input does search by site</font> <font color="red"><input name="as_sitesearch" value="forumserver.twoplustwo.com"></font> <interpret browserResultType="result" charset = "UTF-8" resultListStart="<!--a-->" resultListEnd="<!--z-->" resultItemStart="<!--m-->" resultItemEnd="<!--n-->" > </search> </pre><hr /> Save this as google2p2.src in the Mozilla Firefox/searchplugins directory and save this image as google2p2.gif for a nice icon. |
#5
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
Nice. I haven't been able to try this yet since I'm at home, but if you wanted to create one for the 2+2 archives, you should be able to copy twoplustwo.src and replace forumserver.twoplustwo.com with archiveserver.twoplustwo.com, yeah?
|
#6
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
[ QUOTE ]
Nice. I haven't been able to try this yet since I'm at home, but if you wanted to create one for the 2+2 archives, you should be able to copy twoplustwo.src and replace forumserver.twoplustwo.com with archiveserver.twoplustwo.com, yeah? [/ QUOTE ] Yeah, but the archiveserver search would require a change in date range. Ideally, you would be able to specify the start date for the archives in absolute terms, but the search form only takes relative terms. And the date range is limited to 6 months. So I suggest the following modification to the daterange area of the code in addition to changing the URLs: <font class="small">Code:</font><hr /><pre> <input name="daterange" value="1"> <input name="newerval" value="10"> <input name="newertype" value="m"> <input name="olderval" value="4"> <input name="oldertype" value="m"> </pre><hr /> |
#7
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
This is really cool. Thanks a lot, dude. Just so I'm clear on how this works, the non-google one requires heavy use of + and " right? The google one works more like a normal search engine?
|
#8
|
|||
|
|||
Re: Help me create a 2+2 Firefox Search Engine
Using + and " will work for both. However, as you suggest, using those kinds of markers is probably more important for the non-Google forum search. By the way,the minus sign is often overlooked but it is also helpful, snce it can eliminate things you don't want. So if you want to search for mods but not for party you can do a search for +mod -party
Two other quick things: KneeCo is submitting this to the mycroft search site, so it should soon be a snap to install this. Here is an icon for the archivesearch |
|
|