Need help in Frames

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Freedolen
    New Member
    • Mar 2007
    • 17

    Need help in Frames

    Hi

    1. I found a website "http://www.gahooyoogle .com" which is a search engine and fetches result from both yahoo and Google.
    2. tried to develop a similar one but with more simpler and i choose(Hakia, AltaVista and Google) as my search engines. I developed a html(MySearchPa ge.html) with textbox and submit button, when search term entered and clicking on submit button it calls a perl file.
    3. In perl file there is a Html code, the window is first separated to two rows, first row again calls the html file(MySearchPa ge.html) and second row is separated to three columns. These three columns contains the results of the search engines.
    4. Now i am entering the new search term in the first frame which contains the html file(MySearchPa ge.html) and the results are displayed in the same frame. But i need the results to be displayed in the second set of three frames without affecting the first frame, the first frame should always contain the html file only
    I believe there are no problems with my perl code and suggest me the proper html coding. I have posted the perl code also which contains html coding.

    HTMLCode(MySear chPage.html):
    [CODE=html]
    <html>
    <body>
    <form method="post" action="http://localhost:8080/cgi-bin/Searchengines.p l">
    <input type="text" name="q" size="50"/>
    <input type="submit" name="sbm" text="Submit"/>
    </form>
    </body>
    </html>
    [/CODE]
    PerlCode(Search engines.pl):
    [CODE=perl]
    #!C:/Perl/bin/perl -wT
    use strict;
    use CGI qw/:standard/;
    use CGI::Carp qw(fatalsToBrow ser warningsToBrows er);
    my $searchterm;
    if(param('q'))
    {
    $searchterm = param('q');
    }
    print header;
    print "<html>";
    print "<frameset rows='10%,*'>";
    print "<frame src='http://localhost:8080/MySearchPage.ht ml' scrolling='no' noresize/>";
    print "<frameset cols='35%,35%,* '>";
    print "<frame src='http://www.hakia.com/?q=".$searchter m."'/>";
    print "<frame src='http://www.altavista.c om/sites/search/web?q=".$search term."'/>";
    print "<frame src='http://www.google.com/search?q=".$sea rchterm."'/>";
    print "</frameset>";
    print "</frameset>";
    print "</html>";
    [/CODE]
    I am using WindowsXP

    - Freedolen
    Last edited by miller; Aug 30 '07, 01:11 AM. Reason: Code Tag and ReFormatting
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    HTML doesn't control any of that so I'm moving this to the Perl forum.

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      Originally posted by drhowarddrfine
      HTML doesn't control any of that so I'm moving this to the Perl forum.
      Actually it is an html problem because his html code is wrong for a frameset. The perl script should work, after he corrects the html code. Maybe you can address the problems wth his framset document, like lack of proper DTD and lack of target attributes and any other html concerns.

      -Kevin

      Comment

      • Freedolen
        New Member
        • Mar 2007
        • 17

        #4
        Hi,

        I have solved the issue by adding 'target' and 'name' properties in HTML coding

        HTML Modifications:
        <form method="post" action="http://localhost:8080/cgi-bin/Searchengines.p l" target="resultf rame">
        HTML Code Modifications in Perl File:
        print "<frame src='http://www.hakia.com/?q=".$searchter m."' name='resultfra me'/>";
        print "<frame src='http://www.altavista.c om/sites/search/web?q=".$search term."' name='resultfra me'/>";
        print "<frame src='http://www.google.com/search?q=".$sea rchterm."' name='resultfra me'/>";

        -Freedolen

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          In an unrelated issue, I suggest that you use HERE documents instead of multiple print statements when working with html:

          [CODE=perl]
          print <<"END_OF_HTML" ;
          <html>
          <frameset rows='10%,*'>
          <frame src='http://localhost:8080/MySearchPage.ht ml' scrolling='no' noresize/>
          <frameset cols='35%,35%,* '>
          <frame src='http://www.hakia.com/?q=$searchterm'/>
          <frame src='http://www.altavista.c om/sites/search/web?q=$searchte rm'/>
          <frame src='http://www.google.com/search?q=$searc hterm'/>
          </frameset>
          </frameset>
          </html>
          END_OF_HTML
          [/CODE]
          - Miler

          Comment

          Working...