I have general, high level question concerning HTML and Perl. I have a lot of html pages with tables etc that I designed in Dreamweaver. I have a mysql db and perl scripts that extract data from the database. Now I need to take the data and insert it into the tables in the html.
What do people recommend as the best method to do that? I see two options. One is to use print statements in the perl script that prints out all the html and the data. This could get quite messy with all the tags and having to escape certain characters etc:
print ("<HTML><BODY><TABLE><TR>..etc")The one problem I see with this method is that when I alter the page in dreamweaver I have to repaste the code into the perl script.
The other option, which I have used before, is to place tag holders in the HTML page in dreamweaver. For instance whereever I want the date to appear I put something like %Date%. Then I open the html page in perl and parse the page looking for these special tags. Wherever I find the tag I replace it with data from the db.
What do people think of these two methods or is there a better way to go about what I'm trying to do?
Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.