Re: HTML::Template with simplified/automated fill in from database.

Ronald Schmidt <[email protected]> Sat, 23 Feb 2008 14:13:56 -0500
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
Mark Fuller wrote:


> On Sat, Feb 23, 2008 at 5:13 AM, Ronald Schmidt
> <[email protected]> wrote:
>   
>> I am looking to generate easy visualizations of
>>  objects serialized in a database USING the underlying model.
>>     
>
> It sounds like you're talking about a glue between "model" components
> like dbix::class, class::dbi, etc?
>   
Close.  Yes a glue layer between HTML::Template and a database.  I could 
try to use some of these higher layer abstractions (including Rose:DB) 
or use a modern DBI layer with its 
primay_key/primary_key_info/foreign_key_info functions ...
> What would drive it? An existing template, or an existing data
> definition? I see those two choices like this:
>
> 1) For a data structure, create a template on the fly, and populate it?
>   - Isn't that data dumper?
>   
1)  Is NOT the driver.  As I see it, it is often difficult to guess the 
structure of underlying objects correctly from a schema.
> 2) For a template, get a list of params in the template and populate
> them if the same-named item is found in a data structure (retrieved
> from a model component)?
>   
2) Is the proposed driver.  Retrieved from model component or schema.
> Is that right?
>   
It all sounds harder to explain than I thought it would be to use ;).  
Any further thoughts?
> Mark
>   
  <html>
  <head><title>Test Template</title>
  <body>
  <TMPL_LOOP NAME="+books">
    <ul>
        <li />Title is "<TMPL_VAR NAME=".title">"
        <li />ISBN is <TMPL_VAR NAME=".isbn">
        <li />Authors are:
        <ul>
            <!-- name below is shorthand for +books.book_id.authors -->
            <!-- could still be abbreviated to +authors if fk's link 
tables --> 
        <TMPL_LOOP NAME=".book_id.authors:ORDER_BY:.last_name,.first_name" >
            <li /><TMPL_VAR NAME=".last_name">, <TMPL_VAR 
NAME=".first_name">
        </TMPL_LOOP>
        </ul>
    </ul>
  </TMPL_LOOP>   
  </body>
  </html>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Html-template-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/html-template-users