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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
One thing I didn't like about HTML::Template (maybe I just didn't understand it enough to come up with a clean solution) was the following.

I wanted to give the HTML developers a set of variables that they could use. They could pick and choose which of the set they wanted to display. It was a snippet of HTML to display the current weather, so they could show "wind speed", "wind direction", "temperature", "humidity", and so on.... I did something like:

$tmpl = HTML::Template->new('filename' => $TEMPLATE); $tmpl->param('Temperature' => $current->{'Temperature'}); $tmpl->param('WindDirection' => current->{'WindDirection'}); $tmpl->param('WindSpeed' => $current->{'WindSpeed'}); ... print $tmpl->output();

and the HTML developers would ideally be able to select from those variables and use them like this:

<TABLE> <TR> <TD> <SPAN CLASS="weather-temp"> <!--TMPL_VAR NAME="Temperature"-->&deg;F </SPAN> </TD> </TR> </TABLE>

But actually what I had to do was put ALL the variables into the template, and hide them as a comment, otherwise I would get some error:

<H3>Current weather</H3> [insert HTML here using a selection of the variables below] <!--DO NOT REMOVE:<!--TMPL_VAR NAME="Temperature"--><!--TMPL_VAR NAME= +"PerceivedTemperature"--><!--TMPL_VAR NAME="R elativeHumidity"--><!--TMPL_VAR NAME="WindDirection"--><!--TMPL_VAR NA +ME="WindSpeed"--><!--TMPL_VAR NAME="Pressure" --><!--TMPL_VAR NAME="Visibility"--><!--TMPL_VAR NAME="Icon"--><!--TMP +L_VAR NAME="IconDescription"-->--> ...

and I just find that extremely ugly. What's more, if your variables are within a TMPL_LOOP (which I also did a list of news headlines, so in fact I found myself in that situation), then you have to put that blob of commented-out TMPL_VARs inside that loop.

Also I found that somehow this setup was confusing to the HTML designers, so I ended up having to edit the HTML anyway (maybe that's unique to my situation, though), thus smashing my dreams of never having to look at the HTML again.


In reply to Re: Re: rant on = qw(HTML::Mason Embperl Template etc) ; by kwoff
in thread rant on = qw(HTML::Mason Embperl Template etc) ; by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found