Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Integration of SQL Search Results Into An Existing HTML Template

by CountZero (Bishop)
on Sep 21, 2013 at 09:10 UTC ( [id://1055117]=note: print w/replies, xml ) Need Help??


in reply to Integration of SQL Search Results Into An Existing HTML Template

What you want is a Template Engine. I am very fond of Template Toolkit, but there are many others. Just search CPAN for "template".

What you do is, you write the HTML page and replace the variable parts (where the output of your database query will go) with Template-Toolkit variables and then your CGI-script provide the data to the Template-Toolkit variables and you run the Template engine to combine both and output it to the browser.

If you want to go one step further, explore the power of Web-frameworks such as Dancer or Catalyst where the templates and databases and all other important stuff (authentication, authorisation!) all come seamlessly together.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re: Integration of SQL Search Results Into An Existing HTML Template

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found