in reply to Re: rant on = qw(HTML::Mason Embperl Template etc) ;
in thread rant on = qw(HTML::Mason Embperl Template etc) ;
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"-->°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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: rant on = qw(HTML::Mason Embperl Template etc) ;
by maverick (Curate) on Nov 10, 2001 at 06:05 UTC | |
by kwoff (Friar) on Nov 12, 2001 at 04:53 UTC |