Gossamer Forum
Quote Reply
Plug in Idea/Request
Hi guys

I am trying to make other websites able to use my database search function on their sites.
Or to use it where the search_Results_page will have the website that they came from logo or a link back to that site...

I remember that such a Mod was available for Links 2 (regular).
Several sites have asked me about that so far.
Any input or suggestion will be greatly appreciated...

Regards
Abd

http://www.idleb.com
Quote Reply
Re: Plug in Idea/Request In reply to
This is just a quick way but you might be able to make a simple tag to detect the referer and show the corresponding image.

You would need to get an image from the webmaster of the other site obviously and then create a tag like...

sub {
$url1 = "http://www.wiredon.net";
$url2 = "http://www.microsoft.com";
$url3 = "http://www.MYURL.com";

if ($ENV{'HTTP_REFERER'} eq $url1) {
$img = "http://www.mydomain.com/img/wiredon.gif";
}
elsif ($ENV{'HTTP_REFERER'} eq $url2) {
$img = "http://www.mydomain.com/img/microsoft.gif";
}
elsif (!$ENV{'HTTP_REFERER'} or ($ENV{'HTTP_REFERER'} eq $url3)) {
$img = "http://www.mydomain.com/img/DEFAULT-IMG.gif";
}
return $img;
}


Then put the tag on whatever page you want and it will show the image.
There are definitely better solutions but that was a quick idea I thought of.

Paul Wilson.
http://www.wiredon.net/gt/
Coming soon => www.perlmad.com
Quote Reply
Re: Plug in Idea/Request In reply to
Actually...the better approach is to have your users add hidden fields to the search form codes...

EXAMPLE:

Code:

<input type="hidden" name="asite_title" value="TITLE OF SITE">
<input type="hidden" name="asite_url"> value="URL OF SITE">
<input type="hidden" name="asite_logo" value="LOGO URL">
<input type="hidden" name="asite_bgcolor" value="BACKGROUNDCOLORCODES">


Then simply edit the search_results.html template file...add conditional statements...

Example:

Code:

<%if asite_logo%>
<img src="<%asite_logo%>">
<%endif%>
<%ifnot asite_logo%>
<%include header.txt%>
<%endif%>


Or a more robust solution is creating another table called Preferences, which stores all the above information, and should contain UserID as the PRIMARY KEY, NON-AUTO-INCREMENTED...then you could add a parameter in your query string, such as asite, which would equal the USERID in the Preference table.

You would have to follow Paul's suggestion for pulling the referring page and then lookup that REFERER in the PREFERENCE table and then print out the values from the PREFERENCE table into the search_results.html template file.

The first approach is much simpler since it involves very limited coding on your part.

Regards,

Eliot Lee
Quote Reply
Re: Plug in Idea/Request In reply to
Thanks guys

so easy and Works great....
using the same idea I got it where Specific users can have up a full customized header..
really appreciated

Regards
Abd

http://www.idleb.com