Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Saving DB output to an HTML file

by rodry (Beadle)
on Aug 29, 2000 at 04:26 UTC ( [id://30060]=perlquestion: print w/replies, xml ) Need Help??

rodry has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a web site that stores Resume information (along with photos) of whoever wants to subscribe to the web site.

I decided that for better performance I should save the generated pages into HTML text files and then link directly to it thru the URL instead of sending queries to the DB.

I know how to write to a text file a few lines of DB generated output, but not a page that is generated from more than three separate queries, like the ones from the website I just mentioned.

I need some directions as to how to attack this particular problem.

Thanks in advance...

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Saving DB output to an HTML file
by vaevictus (Pilgrim) on Aug 29, 2000 at 17:41 UTC
    Writing a text file from multiple query's is not any different than writing it from one.

    Well... you can always open a file for appending... so depending on your particular format,

    //query number 1 $current_resume=$result->{'CustomerID'}; // or the like open (FILE,">>$current_resume"); // open the file based on the curren +t user in APPEND MODE print FILE $header_information; // title and so on print FILE $query_one_data; close FILE; //IF NECESSARY //query number 2 open (FILE,">>$current_resume"); //IF CLOSED previously. print FILE $query_two_data; close FILE; // etc... for as many queries that you need.
    I may be way off target, but that's what the reply button is for.
Re: Saving DB output to an HTML file
by arturo (Vicar) on Aug 29, 2000 at 20:57 UTC
    I would check out using templates of some sort, such as HTML::Template and/or CGI::FastTemplate.
    The concept's fairly simple, you create an HTML file which has 'placeholders' in it, and you can fill in the data however you like; you can even put loops in the placeholders, so you can put 1-n entries in under (say) past experience. What you get, basically, is a common look and feel for the resumes, but each will have the user's personal info in it.
    I'd like to suggest, too, that you just do it on the fly. Saves space, and also makes sure that the user has the most up-to-date version, synched to her info in the DB. I'd only go with caching if you have a very high-volume site or an unreliable DB connection.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://30060]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-18 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found