Link to home
Start Free TrialLog in
Avatar of generous
generous

asked on

frames in perl

Hi,

How do get frames happening in perl?  I have a page that outputs info in a txt file into a table of cells, it is super long and i would like to retain the top headings for greater readabiltiy.  Can i do this somehow, if so how?

Once again, since i haven't a clue about how hard this is, if the answer looks complicated i will boost the pts.
Thanks.

ASKER CERTIFIED SOLUTION
Avatar of alamo
alamo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
alamo, are you referring to style sheets?
(Note, I'm not even close to sure how those work...)
Avatar of alamo
alamo

Yes, style sheets and layers. I have seen questions asked at EE over in the HTML section that make me think it could work, but I never followed the discussion enough to know myself how to do it.
Avatar of generous

ASKER

Wow, what an answer!  Umm, only it does not spell it out for me.  How is this for a strategy.   The script writes the dynmaic info to a file (not completely sure how to do this), then it calls the frameset file (using location:). The thrid file is hard coded with the heading.

Could you provide me with the code to write to that file?  Is it simply
    open(tablefile,"bottom.html");
    print tablefile "<td><b>$currenttotal</b></td>\n";   #this being done for each bit of info
    close(tablefile);

Will this work?

Pls note, the issues you have raised about the table's loading time and apperence are occuring right now, but have been decided to be "liveable".
There's a possible problem there, it all depends on how your generate the information.

The problem arises in the fact that there is a single copy of bottom.html for everyone. That means if two people load the page at the same time, one may get the other's info. And more likely, if someone hits reload (or in some cases uses the Back button) they will get the latest copy of bottom.html, not the one they generated.

In some applications this is no problem, the script just generates a page with the latest info anyway, rather than a different page based on what the user asked for. If yours is like this, then what you propose will work. You need to open the file for output with
open(tablefile,">bottom.html");
so that you can write to it. You also need to print the entire html page, not just  the <td> ... </td> bits.

If however the page you generate is different for each user and each time its loaded, a much better approach is to not use Location: for the frameset but instead for your main script to print the frameset page itself in response to the original request, and make the bottom frame a link to another script (or the same script with an additional parameter). The second script would then dynamically generate the page, just like your current script. This only works for scripts loaded from a GET form or link, not a POST, so that the URL of the bottom frame can include all the info needed to generate the page. If it works for you though, you can avoid dealing with multiple temporary files.

Let me know which approach of the above you will take, and I can provide more info if needed.
Hi,

I got the frames to work by writing the ouput to one of the three frame html files.  The issuse of multiple viewers of bottom.html is not a concern, just as you suggested, it is only a listing of current info.  However in the future i might make the files tmp and be erased upon clicking of a button, if privacy issues do arise.

But the location is not working.  Could it be b/c of it is below the print "content-type: text/html\n\n"; line.  I can never understand how that line effects so much of my code.  Where should the location line go?

Ps.  If you do not answer, Thanks Alamo I have learned alot from this attempt and your advice.
When you use Location it should be the only line you print  and should have \n\n at the end.

print "Location: http://whatever.com/etc\n\n";

You are telling the browser to go somewhere else - the place you send it will set its own Content-type and other headers.