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

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

by CountZero (Bishop)
on Sep 21, 2013 at 09:10 UTC ( #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? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2021-12-09 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (36 votes). Check out past polls.

    Notices?