45 users online (0 members and 45 guests)  

Thread: perl problem


  Results 1 to 3 of 3

Related

  1. Perl Counter Problem    Forum: CGI Perl Forum
    Replies: 4
  2. problem with rss updation and perl    Forum: CGI Perl Forum
    Replies: 1
  3. Perl dbi with mysql problem    Forum: CGI Perl Forum
    Replies: 1
  4. Perl revisit problem    Forum: CGI Perl Forum
    Replies: 1
  5. cgi script/perl problem    Forum: CGI Perl Forum
    Replies: 4
  1. #1
    haunsa18's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    6

    perl problem

    i want to develop a site exactly like below site in perl.
    the url is :
    http://www.shaadi.com/partner_search/matrimonial_search/searchresults.php
    when click on foto or "view full profile" the next page displays more information about the individual.
    u can visit my site which is under construction ; its url is http://www.vidarbhasamajsangh.com/home.htm
    here u will find search options ; when filled those options it will redirect to next page same as above first url.
    here arises my problem; i can't develop the second page as it is done on shaadi.com.
    Anybody can pl. help me out.
    thnx,
    haunsa.

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: perl problem

    Hello,
    Theres lots of ways you could develop a system like this. On Shaddi.com they use PHP which is often the best solution for a website like this. It depends on how you want to store and process information. Are you using a database or storing and retrieving information from a txt file?
    If you were using a database data retrieval is so much easier, and quite obvious.
    Here is a very simple way you could lay out a txt file (with minimum information).
    1,male,31,Chris
    2,male,22,John
    3,female,42,Julia
    4,male,18,Peter
    5,female,19,Lucy
    Now we have enough information to complete a search on your website. I have also included a name as just one example of a piece of profile information.
    _________________________________
    Code:
    #So we connect to your website form
    $gender = param('gender');
    $age_from = param('age_from');
    $age_to = param('age_to');
    #Open the txt file containing all data
    open (LOG, "</Path/To/Text/File/log.txt") || die "Cannot Open";
    flock (LOG, 2) || die "Cannot Flock";
    my @log = <LOG>;
    close (LOG) || Error ('close', 'file');
    #Now go through each line and split the information
    foreach (@log) {
    @log_2 = split(/\,/, $_);
    #If the gender and age range is what the user required, store which line number it is
    if (($log_2[1] eq $gender) && ($log_2[2] >= $age_from) && ($log_2[2] <= $age_to)) {
    @store = push($_);
    }
    else { next; }
    }
    #Now you would want to print the information properly, however this is just to show you
    foreach (@store) {
    print "<p>$_";
    }
    _________________________________
    Chris
    Last edited by vinyl-junkie; 10-15-2007 at 06:10 AM. Reason: Added code tags

  3. #3
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: perl problem

    Right I don't think I answered your question. Sorry mate.
    However, once you have processed the information like above, you know which line number the info is stored to (the first element of each line (bear in mind though perl starts at 0))
    So when you print the results of the search (inc the photo etc), you can carry the line number i.e.
    <A HREF="www.yoursite.com?line_number=$log_2[0]></A>
    Or something like that anyway.
    Then on the next page it can pick up the param line_number, use the information and print the information stored in the file accordingly.
    Etc etc



Tags for this Thread