Gossamer Forum
Home : General : Perl Programming :

"reframing" search results

Quote Reply
"reframing" search results
I use frames on my site, but people often link to my search or search results externally (which I want to encourage, if I can figure this out...)

What I want to do is to put a javascript in all my templates
Code:
<script langugage="JavaScript">
if(window==top.window)
{top.window.location='http://myurl.com/cgi-bin/reframe.pl'}
</script>
and then have a small cgi script which will print
Code:
<HTML><HEAD>
<FRAMESET>
<FRAME NAME="left" SRC="left.htm">
<FRAME NAME="body" SRC="Where the visitor was just Redirected From">
<FRAME NAME="right" SRC="right.htm">
</FRAMESET></HEAD></HTML>
Is this possible?

I love working with Links mods, but my perl knowledge is still not up to this small task. Any help creating the perl reframer script or pointing me in the right direction would be greatly appreciated!

Thanks.

Quote Reply
Re: "reframing" search results In reply to
Okay...I have looked at your Thread a few times and still a bit confused....Do you want people to search and have the results displayed within your framed site???

This would be a bit complicated...One suggestion is to create an extra template file that is a "framed" version of your site....

I can't be too specific about what you need, but here are some starting points:

1) In this new template file, use frameset codes similar to what you have in the home.html file.

2) Then put the following conditional codes in your search.cgi file:

Code:

if ($in{'frame'} eq "yes") {
&search_frame_results;
}
else {
&search_results;
}


3) Then add instructions in your site for people to add the following hidden field in their search box codes for your site:

Code:

<input type="hidden" name="frames" value="yes">


And then for the search link, have people add the following argument in the query string:

Code:

&frames=yes


Of course...these are just basic suggestions...I know that they will have to be tweaked to work...BTW: Since this deals with Links 2.0, you probably should've posted this request in the Links 2.0 Customization Forum IMHO.

Regards,

AnthroRules
Quote Reply
Re: "reframing" search results In reply to
Thanks very much Eliot, but I don't think I adequately explained what I need.

My entire links2 directory is generated as the center (or body) frame of my site. (frames are not built into the links templates - it's just that all the paths into my links directory that I create call the links pages as the body frame.)

The problem is that people link to the center frame only, which is sometimes dynamically generated, and when they do so, the layout is off.

I'm looking for a way to take whichever of my links pages is opened (including but not limited to search results), and if it is not within my frameset, surround it with the correct frames while maintaining the page itself as the body or center frame.

It seems like this would be possible with perl, if I could learn the correct way to find out the referring URL from which they were directed (by the hopefully generic javascript to the perl script) and print this as the body frame...

Thanks again.

Quote Reply
Re: "reframing" search results In reply to
Yes...you can extract a user's REMOTE ADDRESS and HOST via environmental variable codes, however, ultimately it will involve frameset codes in an alternative template file so that users will hopefully get the same design coming from an external site...I know this must not make sense...but I am losing steam fast...Sorry.

Regards,

Regards,

AnthroRules
Quote Reply
Re: "reframing" search results In reply to
Neither the REMOTE ADDRESS (which seems to be just the visitor's IP) nor the HOST environment variables seem able to find the previous URL of the visitor... maybe this just isn't possible with perl.

(originally I thought I might be able to do this with just SSI, but I found that unless the visitor actually clicked a link to the ssi page, 'HTTP-REFERER' just printed as (none).)

The problem is that I want to build the "reframing" into my site rather than relying on people who create links to my stie to do it correctly.

Maybe what I need to do though (in additon to figuring out the seemingly simple perl script) is to find the correct javascript code to pass the URL to my perl script rather than trying to use perl to retrieve it...

If the javascript passed the URL (i.e. calling myscript.cgi?url=where-the-javascript-was.html) then it probably wouldn't be that difficult to define url as a variable and then print that as the center frame...

(I'm way over my head, so we'll see)

Thanks again.

Quote Reply
Re: "reframing" search results In reply to
hello marinedesign

Perhaps this will solve all your problems.I'm using it too!
The script i use is at the bottom of:
http://gossamer-threads.com/...w=collapsed&sb=5

This is a great way to "secure" your site.

Greetings,
[removed by request]
The Netherlands (Europe)

Quote Reply
Re: "reframing" search results In reply to
Normal way would be to ask if your (linked) site is inside the right frameset (javascript) and jump to your home.
But you want to show the linked page and the frames around.
Ok. But for what do you need the referer?

I would do the following:

Example. Someone links search.cgi?lala=lala
then you ask inside your script for your frameset, if its not there then you call your own frameset via cgi and the data given; something like lalala.cgi?URL=search.cgi?lala=lala

##perl

frameset
src1=static.htm
scr2=given input
scr3=static2.htm

That should fix it.

BTW: The best thing in my work this week, was a new mod for the apache, asking for the referer.
So you could save every file or dir from linked or called by console.
Nobody could call something, if its not refered from my own site :-)

Robert

Write for Url, if you need this or search (a while) at apache.org.