html-template-users Mailing List for HTML::Template (Page 17)
Brought to you by:
samtregar
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(42) |
Jul
(80) |
Aug
(77) |
Sep
(97) |
Oct
(65) |
Nov
(80) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(63) |
Feb
(47) |
Mar
(45) |
Apr
(63) |
May
(67) |
Jun
(51) |
Jul
(78) |
Aug
(37) |
Sep
(45) |
Oct
(59) |
Nov
(50) |
Dec
(70) |
2004 |
Jan
(23) |
Feb
(90) |
Mar
(37) |
Apr
(53) |
May
(111) |
Jun
(71) |
Jul
(35) |
Aug
(58) |
Sep
(35) |
Oct
(35) |
Nov
(35) |
Dec
(20) |
2005 |
Jan
(51) |
Feb
(19) |
Mar
(20) |
Apr
(8) |
May
(26) |
Jun
(14) |
Jul
(49) |
Aug
(24) |
Sep
(20) |
Oct
(49) |
Nov
(17) |
Dec
(53) |
2006 |
Jan
(12) |
Feb
(26) |
Mar
(45) |
Apr
(19) |
May
(19) |
Jun
(13) |
Jul
(11) |
Aug
(9) |
Sep
(10) |
Oct
(16) |
Nov
(17) |
Dec
(13) |
2007 |
Jan
(9) |
Feb
(12) |
Mar
(28) |
Apr
(33) |
May
(12) |
Jun
(12) |
Jul
(19) |
Aug
(4) |
Sep
(4) |
Oct
(5) |
Nov
(5) |
Dec
(13) |
2008 |
Jan
(6) |
Feb
(7) |
Mar
(14) |
Apr
(16) |
May
(3) |
Jun
(1) |
Jul
(12) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(1) |
May
|
Jun
(6) |
Jul
(5) |
Aug
(3) |
Sep
(7) |
Oct
(1) |
Nov
(15) |
Dec
(1) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(3) |
Mar
|
Apr
(28) |
May
|
Jun
|
Jul
(3) |
Aug
(4) |
Sep
(3) |
Oct
|
Nov
(8) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Gabor S. <sz...@gm...> - 2006-09-12 07:03:39
|
On 9/12/06, Justin Simoni <ju...@sk...> wrote: > At the moment, I'm fixing the errors my fairly simple test is turning > up in my templates. I'm fairly pleased of the results I've gotten > back, most of the errors reported are, in fact, goofs in the HTML of > the HTML::Template templates. > Yeah that would be a nice addition to the testing modules. In addition I guess there is some code in HTML::Template that validates if a given template is a valid template. Using that could be part of your tests. Gabor |
From: Justin S. <ju...@sk...> - 2006-09-12 06:49:01
|
On Sep 11, 2006, at 11:58 PM, Gabor Szabo wrote: > Returning to my soapbox, what if one of the values pasted into the > template is an invalid piece of HTML code. e.g. '23 < 42'. > > The templates are still valid but the generated HTML is not. Very much true, although what I'm attempting to test is the structure of the HTML in the templates themselves. I think testing the validity of output of HTML::Template templates a whole different cookie - and wouldn't be hurt by valid HTML in the template to begin with. I'm not sure what the solution is to that, since each template wants a different set of variables with different values being different for each value. Perhaps a solution to that would be to create a WWW::Mechanize robot that visits all the screens (known) to exist in the webapp and report of any problems with the HTML. I *guess* that would be fun, although it still doesn't test every instance of what gets passed to HTML::Template. Another solution would be to filter all the variables that are sent to HTML::Template before they are. HTML::Template is only called directly in one place in the app, so adding that wouldn't be a problem. Another may be just to enforce the various ESCAPE parameters in the HTML::Templates where they'd do the most good. That would be as easy as appending the program's style guide. I may worry about that later (and funny, I can't find anything about validating those conditions). At the moment, I'm fixing the errors my fairly simple test is turning up in my templates. I'm fairly pleased of the results I've gotten back, most of the errors reported are, in fact, goofs in the HTML of the HTML::Template templates. Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: Mailing List - http://justinsimoni.com/mailing_list.html On Sep 11, 2006, at 11:58 PM, Gabor Szabo wrote: > On 9/12/06, Justin Simoni <ju...@sk...> wrote: >> >> And, from the small set of files I've tested, looks like they're all >> structurally sound HTML files (except for the problems the tests did >> find), which was a hunch of mine that HTML::Template templates would >> be (sans the embedded comments in tags), since HTML::Template sort of >> mandates a clean separation between design and code. > > Returning to my soapbox, what if one of the values pasted into the > template is an invalid piece of HTML code. e.g. '23 < 42'. > > The templates are still valid but the generated HTML is not. > > Gabor > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Gabor S. <sz...@gm...> - 2006-09-12 05:58:23
|
On 9/12/06, Justin Simoni <ju...@sk...> wrote: > > And, from the small set of files I've tested, looks like they're all > structurally sound HTML files (except for the problems the tests did > find), which was a hunch of mine that HTML::Template templates would > be (sans the embedded comments in tags), since HTML::Template sort of > mandates a clean separation between design and code. Returning to my soapbox, what if one of the values pasted into the template is an invalid piece of HTML code. e.g. '23 < 42'. The templates are still valid but the generated HTML is not. Gabor |
From: Justin S. <ju...@sk...> - 2006-09-12 05:52:31
|
Ok, well, cludged my own solution to this problem: On Sep 11, 2006, at 11:30 PM, Justin Simoni wrote: > HTML::Lint at least barfs on the embedded comments inside HTML tags. > That, of itself may not be valid HTML, in which case I've gotten a > dead end. Before I send the template file to HTML::Lint, I can just strip out the HTML comments, and now I'm just testing the HTML, sans the HTML::Template comments. The only downside to this, is that the line numbers may be different between my templates and what the tests are returning as the line where a problem may lay. Template files aren't usually thousands of lines long, so this shouldn't be the biggest problem in the world. And, from the small set of files I've tested, looks like they're all structurally sound HTML files (except for the problems the tests did find), which was a hunch of mine that HTML::Template templates would be (sans the embedded comments in tags), since HTML::Template sort of mandates a clean separation between design and code. Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: Mailing List - http://justinsimoni.com/mailing_list.html On Sep 11, 2006, at 11:30 PM, Justin Simoni wrote: > > > On Sep 11, 2006, at 3:51 AM, Gabor Szabo wrote: >> that's good, are you also aware of the perl-qa mailing list? > > I had a hunch there'd be a Kult of Kwality Assurancers for Perl :) > >> Why not test the result, after processing using HTML::Template? >> That's what is really important. > > The problem with testing them after they're parsed is that, depending > on the return values of any and every <tmpl_if> and friends block, > the return'd HTML would be different. I'm thinking that most every > HTML::Template template is actually valid HTML structurally, even > with the block statements and thus can be tested for valid structure. > HTML::Lint at least barfs on the embedded comments inside HTML tags. > That, of itself may not be valid HTML, in which case I've gotten a > dead end. > > Justin Simoni > -- > :: is an eccentric artist, living and working in Denver, Colorado > :: URL: http://justinsimoni.com > :: Mailing List - http://justinsimoni.com/mailing_list.html > > > On Sep 11, 2006, at 3:51 AM, Gabor Szabo wrote: >> On 9/11/06, Justin Simoni <ju...@sk...> wrote: >>> Heya, >>> >>> I've thus caught the Test::More and Co bug and find myself >>> wanting to >>> add tests to almost every part of my proggy. >> >> that's good, are you also aware of the perl-qa mailing list? >> >>> html_ok($html, "We're good."); >> >> I am not sure why do you want your templates to be Lint-able? >> It might be "nice" but it does not seem to add business value. >> >> Why not test the result, after processing using HTML::Template? >> That's what is really important. >> >> Gabor >> >> > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Justin S. <ju...@sk...> - 2006-09-12 05:30:25
|
On Sep 11, 2006, at 3:51 AM, Gabor Szabo wrote: > that's good, are you also aware of the perl-qa mailing list? I had a hunch there'd be a Kult of Kwality Assurancers for Perl :) > Why not test the result, after processing using HTML::Template? > That's what is really important. The problem with testing them after they're parsed is that, depending on the return values of any and every <tmpl_if> and friends block, the return'd HTML would be different. I'm thinking that most every HTML::Template template is actually valid HTML structurally, even with the block statements and thus can be tested for valid structure. HTML::Lint at least barfs on the embedded comments inside HTML tags. That, of itself may not be valid HTML, in which case I've gotten a dead end. Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: Mailing List - http://justinsimoni.com/mailing_list.html On Sep 11, 2006, at 3:51 AM, Gabor Szabo wrote: > On 9/11/06, Justin Simoni <ju...@sk...> wrote: >> Heya, >> >> I've thus caught the Test::More and Co bug and find myself wanting to >> add tests to almost every part of my proggy. > > that's good, are you also aware of the perl-qa mailing list? > >> html_ok($html, "We're good."); > > I am not sure why do you want your templates to be Lint-able? > It might be "nice" but it does not seem to add business value. > > Why not test the result, after processing using HTML::Template? > That's what is really important. > > Gabor > > |
From: Michael P. <mp...@pl...> - 2006-09-11 13:55:37
|
Justin Simoni wrote: > Does anyone else have a better strategy for testing the structure of > their HTML::Template templates? I've done 2 things in the past. 1) Load each template, use the query() method to find out what the vars and loops are and fill them in with fake data. Then test the output. PROS: * you can make sure your tmpl_* syntax isn't fatally wrong * you don't need to worry about templates being valid HTML, just the resulting output. CONS: * you're still at the mercy of something like HTML::Lint and it's bugs * you're not testing whether or not someone mispelled a variable name, etc 2) Test the modules that use the templates, not the templates themselves. PROS: * Tests not only the logic in the controller classes, but also that the vars are being passed correctly to the template with the right names. CONS: * Not as easy to write. You can't just write one test that tests all your templates. Plus you need to make sure you exercise every case so that every template is used. I prefer #2. -- Michael Peters Developer Plus Three, LP |
From: Justin S. <ju...@sk...> - 2006-09-10 22:31:10
|
Heya, I've thus caught the Test::More and Co bug and find myself wanting to add tests to almost every part of my proggy. One part of the proggy that I'd love to test are my template files. It seems of good value to test the structure of the templates, as user contributions from people who may not be quite familiar with the templates, but still want to add something, may introduce new formatting bugs. I'm hoping there's a already existing strategy for doing this. I've tried something like this test: #!/usr/bin/perl use Test::HTML::Lint tests => 1; my $html = q{ <table> <!-- tmpl_loop foo --> <tr <!-- tmpl_if __odd__ -->style="background-color:#ccf;"<!--/ tmpl_if-->> <td> Something. </td> </tr> <!--/tmpl_loop--> </table> }; html_ok($html, "We're good."); Which, when run, returns something like: Justins-Computer:/t justin$ perl HTML_Template_test.t 1..1 not ok 1 - We're good. # Failed test 'We're good.' # in HTML_Template_test.t at line 19. # Errors: We're good. # (8:5) </tr> with no opening <tr> # Looks like you failed 1 test of 1. Removing the, "<!-- tmpl_if __odd__ -->style="background- color:#ccf;"<!--/tmpl_if-->" from the HTML snippet seems to make the test pass. Obviously, this isn't a bug in HTML::Template, if anything, it's a bug in HTML::Lint - although I'll have to see if HTML comments are valid markup inside other HTML tags. Even if they are, the test is returning an incorrect error. HTML::Lint hasn't been updated in a while and has a few open bugs, so I don't know if this is the best solution to my needs. Just passing the template to HTML::Template will tell me if the template is accepted and there's no problems with the <tmpl_*> tags, but it's not going to tell me anything about the rest of the HTML. Does anyone else have a better strategy for testing the structure of their HTML::Template templates? I'm wondering what the potential of the block tags making the template itself have inconsistent HTML structure. Probably fairly great, although it may be an interesting thing to enforce; (most) any template could be included without problem in (most) any other template. Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: Mailing List - http://justinsimoni.com/mailing_list.html |
From: Raful Mr M. H <RA...@us...> - 2006-09-07 18:48:22
|
All: I worked on a script that does lots of snmp queries via Apache and Perl. = I was using Mason. However, some of my Net::SNMP return values were = garbled. My assumption was it was the fact that embedded templating = uses a callback method. I rewrote everything in HTML::Template and = voilla! I'm thrilled. Now I need some feedback to see if I am taking = full advantage of mod_perl. Should I change any of the following: relevant piece from apache2.conf PerlModule Apache::DBI Alias /perl/ /usr/lib/cgi-bin/ PerlModule ModPerl::Registry <Location /perl/> SetHandler modperl PerlFixupHandler +Apache::DB PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions +GlobalRequest PerlSendHeader On Allow from all </Location> <Perl> use Carp </Perl> PerlPostConfigRequire /usr/local/lib/site_perl/Apache2/startup.pl relevant portion from sites-enabled/default (I am using Ubuntu.) <VirtualHost *> ServerAdmin webmaster@localhost DocumentRoot /home/mitch/www-dev/yanma ServerName yanmadev.usmc-mccs.org <Directory /home/mitch/www-dev/yanma> DirectoryIndex index.html AllowOverride None Order allow,deny allow from all </Directory> <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> <Location /perl> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all=20 </Location> Finally startup.pl #!/usr/bin/perl use lib qw(/usr/local/lib/site_perl/Apache2); use HTML::Template; use File::Find; use ModPerl::Util; use ModPerl::Registry (); use Apache::DBI; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::RequestUtil (); use Apache2::ServerRec (); use Apache2::ServerUtil (); use Apache2::Connection (); use Apache2::Log (); use APR::Pool (); use APR::Table (); use Apache2::Const -compile =3D> ':common'; use APR::Const -compile =3D> ':common'; use Socket qw(:DEFAULT :crlf); use Net::SNMP; use Net::Ping; use Net::NBName; use DBI; use DBD::ODBC; Apache::DBI->connect_on_init( 'dbi:ODBC:MRIServer2k', '******', = '******', { PrintError =3D> 1, RaiseError =3D> 0, = AutoCommit =3D> 1 } ); print STDERR "Pre-loading HTML Template...\n"; find ( sub { return unless /\.tmpl$/; HTML::Template->new( filename =3D> "$File::Find::dir/$_", cache =3D> 1, ); }, '/home/mitch/www-dev/yanma/', ); 1; Thanks, Mitch Mitch Raful, MCSE CCNP Network Engineer HQMC MCCS 3044 Catlin Avenue Quantico, VA 22134 703-784-5991 "T'm Mitch Raful, and I approved this message."=20 |
From: Karen <kar...@gm...> - 2006-08-30 20:11:55
|
On 8/30/06, Covert, Jake (JSC.) <jco...@fo...> wrote: > Don't think this is a Perl error, so I'm thinking it's an HTML::Template > error, maybe. Yep, it's actually a Perl error. It's complaining about "@{$vendor_hoh{$vendor}}" in line 85: > 85 my ($rif, $rif_out, $graph, $raw, $percent1, $percent2, $percent3) > = @{$vendor_hoh{$vendor}}; Whatever's in $vender_hoh{$vendor}, it's not an arrayref. The problem is earlier in your code. Once %vendor_hoh is populated correctly, your code should work fine, though you could shorten it thus (assuming I haven't made any brainos): $tmpl->param( TMPL_LOOP, [ map { rif => $vendor_hoh{$_}->[0], rif_out => $vendor_hoh{$_}->[1], graph => $vendor_hoh{$_}->[2], raw => $vendor_hoh{$_}->[3], percent1 => $vendor_hoh{$_}->[4], percent2 => $vendor_hoh{$_}->[5], percent3 => $vendor_hoh{$_}->[6], }, sort keys %vender_hoh ] ); |
From: Di D. M. <mdi...@si...> - 2006-08-30 18:03:26
|
I'm no expert, but I believe it's because you didn't pack the hash with an array. For instance; $tmplvar->{hashkey} =3D "aa" is wrong $tmplvar->[0]->{hashkey} =3D "aa" is right So for a hash of hashes your string would be $tmplvar->[0]->{hashkey}->[0]->{hashkey} =3D "aa" -----Original Message----- From: htm...@li... [mailto:htm...@li...] On Behalf Of Covert, Jake (JSC.) Sent: Wednesday, August 30, 2006 1:27 PM To: htm...@li... Subject: [htmltmpl] html template loops (hash of a hash) I'm a bit new to html templates, so I apologize in advance if I ask some obvious questions. I'm working on an HTML::Template loop issue that I can't quite seem to get=20 working just right. Instead of an array of hashes, I'm using a hash of=20 hashes. When I try and run it, it gives me this error: ----------------------- Not an ARRAY reference at ./index2.cgi line 85. ----------------------- Don't think this is a Perl error, so I'm thinking it's an HTML::Template error, maybe. Here's an example of the data set I'm using: The Perl I'm using to pack the hash of hash into something I thing HTML=20 template will understand is below. If anyone can think of what would cause this, let me know. I think I may be=20 trying to push the limits of HTML::Template farther than it supposed to. ----------------=20 Jake Covert (313) 322-6717 (desk) (313) 845-4154 (fax) ---------------- perl index2.cgi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D 80 my @loop; # the loop data will be put in here 81 82 # fill in the loop, sorted by fruit name 83 foreach my $vendor (sort keys %vendor_hoh) { 84 # get the files from the data hash 85 my ($rif, $rif_out, $graph, $raw, $percent1, $percent2, $percent3)=20 =3D @{$vendor_hoh{$vendor}}; 86 87 # make a new row for this vendor - the keys are <TMPL_VAR> names 88 # and the values are the values to fill in the template. 89 my %row =3D ( 90 rif =3D> $rif, 91 rif_out =3D> $rif_out, 92 graph =3D> $graph, 93 raw =3D> $raw, 94 percent1 =3D> $percent1, 95 percent2 =3D> $percent2, 96 percent3 =3D> $percent3 97 ); 98 99 # put this row into the loop by reference 100 push(@loop, \%row); 101 102 } 103 104 # call param to fill in the loop with the loop data by reference. 105 $tmpl->param(TMPL_LOOP =3D> \@loop); 106 = #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D 107 #print @{$vendor_hoh{amls}}; 108 109 # my @loop_data; 110 # push(@loop_data, \%vendor_hoh); 111 # 112 # # Pass the listref to param() 113 # $tmpl -> param( TMPL_LOOP =3D> \@loop_data ); 114 # 115 # 116 # This is HTML::Template part that actually outputs things... 117 # 118 print "Content-type: text/html\n\n", 119 $tmpl->output; 120 print Dumper(%vendor_hoh); =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Template(s) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I have two templates. The first is called index.tmpl.template. It's a template for the real template. I couldn't figure out how to replace the top=20 layer of hashes, so I'm using the perl script to auto-create the real=20 index.tmpl from index.tmpl.template based on the first layer. Perl that does=20 this is here: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if ( /TMPL_LOOP_PLACE_HOLDER/ ) { foreach $rif_file (sort @files) { my @rif_fields =3D split(/\./,$rif_file); $APP =3D (@rif_fields)[0]; $MONTH =3D (@rif_fields)[1]; $vendor_hoh{$APP}->{'rif'} =3D "${APP}.${MONTH}.rif"; $vendor_hoh{$APP}->{'rif_out'} =3D "${APP}.${MONTH}.rif.out"; $vendor_hoh{$APP}->{'graph'} =3D "${APP}.${MONTH}.graph_toc.htm"; $vendor_hoh{$APP}->{'raw'} =3D "${APP}.${MONTH}.raw.gz"; $vendor_hoh{$APP}->{'percent1'} =3D=20 "${APP}.${MONTH}.country_percentages.txt"; $vendor_hoh{$APP}->{'percent2'} =3D "${APP}Software_Usage${MONTH}.txt"; $vendor_hoh{$APP}->{'percent3'} =3D=20 "${APP}Software_percent_Usage${MONTH}.txt"; print OF "\n<TMPL_LOOP NAME=3D\"$APP\">\n"; print OF "<TMPL_IF NAME=3D\"rif\"><TMPL_VAR = rif></TMPL_IF>\n"; print OF "<TMPL_IF NAME=3D\"raw\"><TMPL_VAR = raw></TMPL_IF>\n"; print OF "</TMPL_LOOP>\n\n"; } } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Example of what the template "template" looks like: =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D <TMPL_LOOP NAME=3D"TMPL_LOOP"> <!- TMPL_LOOP_PLACE_HOLDER -> </TMPL_LOOP> =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D When my index.cgi script runs, it reads this index.tmpl.template and replaces <!- TMPL_LOOP_PLACE_HOLDER -> with the real data of: <TMPL_LOOP NAME=3D"$APP"> <TMPL_IF NAME=3D"rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME=3D"raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> Where $APP is the main key of my hash of hash. Example of the finished index.tmpl is below: =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D <TMPL_LOOP NAME=3D"TMPL_LOOP"> <TMPL_LOOP NAME=3D"application_1"> <TMPL_IF NAME=3D"rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME=3D"raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME=3D"application_2"> <TMPL_IF NAME=3D"rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME=3D"raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME=3D"application_3"> <TMPL_IF NAME=3D"rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME=3D"raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME=3D"application_4"> <TMPL_IF NAME=3D"rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME=3D"raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <!- TMPL_LOOP_PLACE_HOLDER -> </TMPL_LOOP> =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D |
From: Covert, J. \(JSC.\) <jco...@fo...> - 2006-08-30 17:28:46
|
I'm a bit new to html templates, so I apologize in advance if I ask some obvious questions. I'm working on an HTML::Template loop issue that I can't quite seem to get working just right. Instead of an array of hashes, I'm using a hash of hashes. When I try and run it, it gives me this error: ----------------------- Not an ARRAY reference at ./index2.cgi line 85. ----------------------- Don't think this is a Perl error, so I'm thinking it's an HTML::Template error, maybe. Here's an example of the data set I'm using: The Perl I'm using to pack the hash of hash into something I thing HTML template will understand is below. If anyone can think of what would cause this, let me know. I think I may be trying to push the limits of HTML::Template farther than it supposed to. ---------------- Jake Covert (313) 322-6717 (desk) (313) 845-4154 (fax) ---------------- perl index2.cgi ===================================================== 80 my @loop; # the loop data will be put in here 81 82 # fill in the loop, sorted by fruit name 83 foreach my $vendor (sort keys %vendor_hoh) { 84 # get the files from the data hash 85 my ($rif, $rif_out, $graph, $raw, $percent1, $percent2, $percent3) = @{$vendor_hoh{$vendor}}; 86 87 # make a new row for this vendor - the keys are <TMPL_VAR> names 88 # and the values are the values to fill in the template. 89 my %row = ( 90 rif => $rif, 91 rif_out => $rif_out, 92 graph => $graph, 93 raw => $raw, 94 percent1 => $percent1, 95 percent2 => $percent2, 96 percent3 => $percent3 97 ); 98 99 # put this row into the loop by reference 100 push(@loop, \%row); 101 102 } 103 104 # call param to fill in the loop with the loop data by reference. 105 $tmpl->param(TMPL_LOOP => \@loop); 106 #===================================================== 107 #print @{$vendor_hoh{amls}}; 108 109 # my @loop_data; 110 # push(@loop_data, \%vendor_hoh); 111 # 112 # # Pass the listref to param() 113 # $tmpl -> param( TMPL_LOOP => \@loop_data ); 114 # 115 # 116 # This is HTML::Template part that actually outputs things... 117 # 118 print "Content-type: text/html\n\n", 119 $tmpl->output; 120 print Dumper(%vendor_hoh); ===================================================== Template(s) ====================================== I have two templates. The first is called index.tmpl.template. It's a template for the real template. I couldn't figure out how to replace the top layer of hashes, so I'm using the perl script to auto-create the real index.tmpl from index.tmpl.template based on the first layer. Perl that does this is here: ======================================= if ( /TMPL_LOOP_PLACE_HOLDER/ ) { foreach $rif_file (sort @files) { my @rif_fields = split(/\./,$rif_file); $APP = (@rif_fields)[0]; $MONTH = (@rif_fields)[1]; $vendor_hoh{$APP}->{'rif'} = "${APP}.${MONTH}.rif"; $vendor_hoh{$APP}->{'rif_out'} = "${APP}.${MONTH}.rif.out"; $vendor_hoh{$APP}->{'graph'} = "${APP}.${MONTH}.graph_toc.htm"; $vendor_hoh{$APP}->{'raw'} = "${APP}.${MONTH}.raw.gz"; $vendor_hoh{$APP}->{'percent1'} = "${APP}.${MONTH}.country_percentages.txt"; $vendor_hoh{$APP}->{'percent2'} = "${APP}Software_Usage${MONTH}.txt"; $vendor_hoh{$APP}->{'percent3'} = "${APP}Software_percent_Usage${MONTH}.txt"; print OF "\n<TMPL_LOOP NAME=\"$APP\">\n"; print OF "<TMPL_IF NAME=\"rif\"><TMPL_VAR rif></TMPL_IF>\n"; print OF "<TMPL_IF NAME=\"raw\"><TMPL_VAR raw></TMPL_IF>\n"; print OF "</TMPL_LOOP>\n\n"; } } ======================================= Example of what the template "template" looks like: =-=-=-=-=-=-=-=-=-=-=-= <TMPL_LOOP NAME="TMPL_LOOP"> <!- TMPL_LOOP_PLACE_HOLDER -> </TMPL_LOOP> =-=-=-=-=-=-=-=-=-=-=-= When my index.cgi script runs, it reads this index.tmpl.template and replaces <!- TMPL_LOOP_PLACE_HOLDER -> with the real data of: <TMPL_LOOP NAME="$APP"> <TMPL_IF NAME="rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME="raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> Where $APP is the main key of my hash of hash. Example of the finished index.tmpl is below: =-=-=-=-=-=-=-=-=-=-=-= <TMPL_LOOP NAME="TMPL_LOOP"> <TMPL_LOOP NAME="application_1"> <TMPL_IF NAME="rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME="raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME="application_2"> <TMPL_IF NAME="rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME="raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME="application_3"> <TMPL_IF NAME="rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME="raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <TMPL_LOOP NAME="application_4"> <TMPL_IF NAME="rif"><TMPL_VAR rif></TMPL_IF> <TMPL_IF NAME="raw"><TMPL_VAR raw></TMPL_IF> </TMPL_LOOP> <!- TMPL_LOOP_PLACE_HOLDER -> </TMPL_LOOP> =-=-=-=-=-=-=-=-=-=-=-= |
From: Jamie K. <jkr...@gm...> - 2006-08-30 16:45:40
|
Here's a short example. my $template = HTML::Template->new( 'filename' => 'some.tmpl', 'loop_context_vars' => 1); my $some_funky_loop = [..#array ref of hashrefs of stuff#.. ]; $template->param('SOME_LOOP' => $some_funky_loop); $template->output(); # template <!-- TMPL_LOOP NAME="SOME_LOOP" --> <!-- TMPL_VAR NAME="__counter__" --> <!-- TMPL_VAR NAME="some_var" --> <!-- TMPL_VAR NAME="another_var" --> <!-- /TMPL_LOOP --> On 8/30/06, Di Domenico, Michael <mdi...@si...> wrote: > > > > > I'm trying to use the loop_context_var option for HTML::Template. > Specifically I'm looking at the __counter__ option. When I do a dump on my > hashref, I can see that it's adding __counter__ along with the other vars, > however, the counter var is always 'undef'. > > > > Is it supposed to be like this? If so, does anyone have an example of its > use? I can't seem to find one on the web anywhere. > > > > Thanks > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > |
From: Di D. M. <mdi...@si...> - 2006-08-30 14:52:55
|
I'm trying to use the loop_context_var option for HTML::Template. Specifically I'm looking at the __counter__ option. When I do a dump on my hashref, I can see that it's adding __counter__ along with the other vars, however, the counter var is always 'undef'. =20 =20 Is it supposed to be like this? If so, does anyone have an example of its use? I can't seem to find one on the web anywhere. =20 Thanks |
From: Matias A. G. <ma...@ni...> - 2006-08-25 20:36:46
|
Hi all, A small tip, that I just 'discover'. Adding: --langdef=3Dhtml_template --langmap=3Dhtml_template:.tmpl --regex-html_template=3D/<tmpl_var\s+([a-zA-Z0-9_]+)>/\1/d,definition/i --regex-html_template=3D/<tmpl_loop\s+([a-zA-Z0-9_]+)>/\1/d,definition/i --regex-html_template=3D/<tmpl_if\s+([a-zA-Z0-9_]+)>/\1/d,definition/i to your $HTML/.ctags file will make ctags to index HTML::Template files. I found that very useful when navigating our code using VIM o other editor. regards, mat=EDas --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar |
From: Matias A. G. <ma...@ni...> - 2006-08-23 16:55:15
|
Hi! I am working in I18N of a price comparisson site these days. Our strategy is: - We use: Locale::gettext (is the simplest locale function, enoght for our need, and very stable, even using threaded apache/mod_perl). - All texts in the PERL code are given using gettext. These texts are translated on the fly, using current site localte setup. e.g: $template->param('pay_type', _($pay_type[$i]); where _() is a wrapper of gettext() - All texts in HTML::Template's templates are given using gettext. This are precompiled. For example we have: welcome.tmpl <<EOF <h1> _'Hello there' <tmpl_var username> </h1> _'Your store balance is %s'_<tmpl_var balance> EOF That is the true template. To use it in a site we precompile it, for exemple: ./precompile_templates.pl en_US.UTF8 and we get: <h1> Hello there <tmpl_var username> </h1> Your store's balance is <tmpl_var balance> or ./precompile_templates.pl es_AR.UTF8 and we get: <h1> Hola <tmpl_var username> </h1> Dispon=E9s de <tmpl_var balance> en tu cuenta We precompile all templates, for all locales, in different directories. By doing that we don't have an extra overhead for I18N. -- All the texts of the sites are in one .po file (actuale, one for each locale), which we edit in poedit (WIN/Linux) o gvim. -- When working on the site layout, in order not to recompile every site after each simple modification (while developing) where use the original templates (not gettext'ed yet). Finally, let me add that we use mysql with UTF8 collation and 'use utf8' pragma in perl. I hope this help, mat=EDas On 8/23/06, Mathew Robertson <mat...@ne...> wrote: > > Hi there, > > There are a number of ways to implement multi-language support, > depending on your personal preference. > > > Dynamic content sometimes shouldn't be translated, other times it > should be translated. eg: if you have the car company "Nissan", in > most languages you dont translate, but in Japanese you do. The > exact circumstances of when to translate, will depend on your > application domain and the linguistic rules of the end-users' language. > > One choice you will need to make is how frequently you will allow > updates to your translated strings. This will determine whether you > need something like a database lookup, or a simple file containing a > relatively infrequently changing set of translations. > > > Static content is often a bit easier: > > - translate the templates (containing the static text) into the > language of choice -> output the HTML content from the appropriate > template file. > > - Use H::T::E to callback into a registered 'translate(..)' function > so that you can lookup translations. > > - Use a version of H::T which has plugin support for more TMPL_xxx > tags, so that you can lookup translations. > > The implementation that you use will depends on whether you have > access to a database to store translations in; and the "page render > time" of your application. Eg: dynamic lookup of translations will > incur a small performance hit when generating the HTML page; using > H::T::E can be a big performance hit. > > > There are a few good Perl modules which may help you implement your > translation mechanism: > > - Locale::Maketext > - pros: fast > : powerful per-language capabilities > - cons: requires programmer input to implement language rules > > - Locale::MakePhrase ** > - pros: powerful meta-language for implementing language rules > : can use database, file or directory based backing stores > - cons: slow - rules need to be evaluated > > ** Note: I wrote this package based on Locale::Maketext, so I may be > a little biased. > > > Example: Our application outputs 6 languages (English, Italian, > Spanish, Korean, Japanese, Chinese) as well as handling dialects > (en_us vs. en_au vs en), using one set of templates that dynamically > lookup translations from a database. > > If you need further info, let me know. > > Mathew > > PS. I am working currently working on (at a slow rate...) a module > which joins H::T with Locale::MakePhrase, so as to simplify some of > the user-space code for handling the language-translation TMPL_xxx tags. > > > Di Domenico, Michael wrote: > > Does anyone have any recommendations on the best way to implement multi > > language support using HTML::Template? I saw a few posts from a few > > years ago on the subject in the mailing list archives, but otherwise I > > can't find much information on the web. Unless I'm looking in the wron= g > > places. > > > > > > > > Thanks > > > > > > > > > > -----------------------------------------------------------------------= - > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > security? > > Get stuff done quickly with pre-integrated technology to make your job > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > > > > > > -----------------------------------------------------------------------= - > > > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > --=20 Mat=EDas Alejo Garc=EDa NITS Argentina | http://www.nits.com.ar UADE | Profesor Adjunto | Departamento de Inform=E1tica |
From: Mathew R. <mat...@ne...> - 2006-08-23 05:48:53
|
Hi there, There are a number of ways to implement multi-language support, depending on your personal preference. Dynamic content sometimes shouldn't be translated, other times it should be translated. eg: if you have the car company "Nissan", in most languages you dont translate, but in Japanese you do. The exact circumstances of when to translate, will depend on your application domain and the linguistic rules of the end-users' language. One choice you will need to make is how frequently you will allow updates to your translated strings. This will determine whether you need something like a database lookup, or a simple file containing a relatively infrequently changing set of translations. Static content is often a bit easier: - translate the templates (containing the static text) into the language of choice -> output the HTML content from the appropriate template file. - Use H::T::E to callback into a registered 'translate(..)' function so that you can lookup translations. - Use a version of H::T which has plugin support for more TMPL_xxx tags, so that you can lookup translations. The implementation that you use will depends on whether you have access to a database to store translations in; and the "page render time" of your application. Eg: dynamic lookup of translations will incur a small performance hit when generating the HTML page; using H::T::E can be a big performance hit. There are a few good Perl modules which may help you implement your translation mechanism: - Locale::Maketext - pros: fast : powerful per-language capabilities - cons: requires programmer input to implement language rules - Locale::MakePhrase ** - pros: powerful meta-language for implementing language rules : can use database, file or directory based backing stores - cons: slow - rules need to be evaluated ** Note: I wrote this package based on Locale::Maketext, so I may be a little biased. Example: Our application outputs 6 languages (English, Italian, Spanish, Korean, Japanese, Chinese) as well as handling dialects (en_us vs. en_au vs en), using one set of templates that dynamically lookup translations from a database. If you need further info, let me know. Mathew PS. I am working currently working on (at a slow rate...) a module which joins H::T with Locale::MakePhrase, so as to simplify some of the user-space code for handling the language-translation TMPL_xxx tags. Di Domenico, Michael wrote: > Does anyone have any recommendations on the best way to implement multi > language support using HTML::Template? I saw a few posts from a few > years ago on the subject in the mailing list archives, but otherwise I > can't find much information on the web. Unless I'm looking in the wrong > places. > > > > Thanks > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Di D. M. <mdi...@si...> - 2006-08-22 20:25:33
|
Does anyone have any recommendations on the best way to implement multi language support using HTML::Template? I saw a few posts from a few years ago on the subject in the mailing list archives, but otherwise I can't find much information on the web. Unless I'm looking in the wrong places. =20 Thanks |
From: Bas A. S. <b.s...@ya...> - 2006-07-20 22:02:18
|
Hi, On Jul 20, 2006, at 23:37 , Roger Burton West wrote: > For me, H::T hits just the right spot between requiring > the web dev to be a programmer (the way Template::Toolkit seems to) > and > a basic regexp search/replace. Well... that is another topic that bit me *hard* on my recent project! I had to transform a bunch of static html pages produced by a html guy (using Dreamweaver) into templates, and it sucked. I'm probably getting old as I expect those designers to understand the concept of html, even though it is largely beneath the surface with an app like Dreamweaver. I wouldn't trust that guy and Dreamweaver with the templates I created, how unobtrusive the H::T(::S) tags may be. Not after I spent 10 hours locating a bunch of incorrect </tr>'s and <td>'s and some <td>'s width attribute that didn't correspond with the size of the image that was displayed in that cell to get the pages to work in more than 1 browser ;) And you all have to believe me when I say I suck at html. Good thing is that all dynamic pages render fine in most browsers. Bad thing is that static pages still don't. Anyway, my life got a bit better tonight so thanks y'all! |
From: Roger B. W. <ro...@fi...> - 2006-07-20 21:37:22
|
On Thu, Jul 20, 2006 at 11:26:28PM +0200, Bas A. Schulte wrote: >H::T::Set is doing what I want just fine; I dropped it in my existing >code, did a s/HTML::Template/HTML::Template::Set/g et voila. That was a primary consideration when I wrote it. (Assuming you're using mine and not the other module of the same name.) >I don't quite get the philosophical issues that were also mentioned >in that thread in my usage scenario; I'm quite keen on separating >business logic from presentation but I feel what I wanted *is* a >presentation issue: I wouldn't want the code to have to know about >mediocre thing such as a "nice" name for a page. I'm with Dmitri on this - it's a small annoyance in an otherwise very useful module. For me, H::T hits just the right spot between requiring the web dev to be a programmer (the way Template::Toolkit seems to) and a basic regexp search/replace. Roger |
From: Dmitri T. <dti...@vo...> - 2006-07-20 21:29:51
|
On Thu, 2006-07-20 at 23:26 +0200, Bas A. Schulte wrote: > I don't quite get the philosophical issues that were also mentioned > in that thread in my usage scenario; I'm quite keen on separating > business logic from presentation but I feel what I wanted *is* a > presentation issue: I wouldn't want the code to have to know about > mediocre thing such as a "nice" name for a page. I share your view. But hey, this ain't our module! :-) - Dmitri. |
From: Bas A. S. <B.S...@ya...> - 2006-07-20 21:26:41
|
On Jul 20, 2006, at 21:37 , Dmitri Tikhonov wrote: > This has already been discussed, most recently here: > > http://sourceforge.net/mailarchive/forum.php? > thread_id=10395329&forum_id=9830 Ok, thanks. I would probably have found that had the search function worked ;) H::T::Set is doing what I want just fine; I dropped it in my existing code, did a s/HTML::Template/HTML::Template::Set/g et voila. I don't quite get the philosophical issues that were also mentioned in that thread in my usage scenario; I'm quite keen on separating business logic from presentation but I feel what I wanted *is* a presentation issue: I wouldn't want the code to have to know about mediocre thing such as a "nice" name for a page. Cheers, Bas. |
From: Dmitri T. <dti...@vo...> - 2006-07-20 19:37:44
|
This has already been discussed, most recently here: http://sourceforge.net/mailarchive/forum.php?thread_id=10395329&forum_id=9830 - Dmitri. On Thu, 2006-07-20 at 21:33 +0200, Bas A. Schulte wrote: > Hi all, > > I've been using H::T for some time for simple stuff but I'm using it > for something more complicated now. What I'd like to do is have one > site-wide header template that gets included from individual pages > receive a variable from the individual page's template. > > Something like: > > site-wide.tmpl: > > <table> > <tr> > <td>(Title of subpage)</td> > </tr> > .... > </table> > > Then individual pages have this: > > <html> > <body> > <TMPL_INCLUDE NAME="header.tmpl"> > > ... > </body> > </html> > > Now what I'd like to do is set a variable in the individual page > containing the "nice" title of the page. I don't want to set that > name from code (it's a generic handler that basically calls H::T->new > and sticks in some user properties. Ideally, I'd like to be able to > set a variable in the individual page and do this in site-wide.tmpl: > > <table> > <tr> > <td><TMPL_VAR NAME="title"></td> > </tr> > .... > </table> > > And set the value for "title" in the individual page's template: > > <html> > <body> > <TMPL_SET_VAR title="abc"> > <TMPL_INCLUDE NAME="header.tmpl"> > > ... > </body> > </html> > > From the perldoc, I can't find it and searching the mailing list > won't work ("Unable to contact search server" etc.). A quick browse > did reveal some info but not quite something as simple as I need now :) > > Thanks, > > Bas. > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Bas A. S. <B.S...@ya...> - 2006-07-20 19:34:03
|
Hi all, I've been using H::T for some time for simple stuff but I'm using it for something more complicated now. What I'd like to do is have one site-wide header template that gets included from individual pages receive a variable from the individual page's template. Something like: site-wide.tmpl: <table> <tr> <td>(Title of subpage)</td> </tr> .... </table> Then individual pages have this: <html> <body> <TMPL_INCLUDE NAME="header.tmpl"> ... </body> </html> Now what I'd like to do is set a variable in the individual page containing the "nice" title of the page. I don't want to set that name from code (it's a generic handler that basically calls H::T->new and sticks in some user properties. Ideally, I'd like to be able to set a variable in the individual page and do this in site-wide.tmpl: <table> <tr> <td><TMPL_VAR NAME="title"></td> </tr> .... </table> And set the value for "title" in the individual page's template: <html> <body> <TMPL_SET_VAR title="abc"> <TMPL_INCLUDE NAME="header.tmpl"> ... </body> </html> From the perldoc, I can't find it and searching the mailing list won't work ("Unable to contact search server" etc.). A quick browse did reveal some info but not quite something as simple as I need now :) Thanks, Bas. |
From: Dietrich S. <die...@vi...> - 2006-07-05 15:03:44
|
Thank you for your answer but it does not help with the eclipse WTP html editor. I tried the following: <link rel="stylesheet" href="<!-- TMPL_VAR NAME=BASEURL -->/admin.css" type="text/css"> but the WTP HTML editor throws the following errors: > Start tag (<link>) not closed. and > Multiple annotations found at this line: > - Invalid text string (/qsadmin.css" type="text/css"> > > ). > - Invalid character used in text string (/qsadmin.css" > type="text/css"> > > ). > Maaged Mazyek schrieb: > Dietrich Streifert schrieb: >> Hello List, >> >> I'm currently working on a projekt which uses HTML::Template. As a >> development platform I use eclipse EPIC perl plugin and WTP. >> >> Does anyone know a way to configure the html editor to ignore the >> HTML::Template tags without deactivating validation? >> Or even better to allow the html editor to valdate the HTML::Template >> syntax? >> >> Thank you for answering. >> >> Best regards... >> >> > Hi Dietrich, > > how about using the comment-style-syntax like <!-- TMPL_VAR > NAME=TESTVAR --> > Described here: > http://search.cpan.org/~samtregar/HTML-Template-2.8/Template.pm#NOTES > > regards, > maaged -- Mit freundlichen Grüßen Dietrich Streifert Visionet GmbH |
From: Maaged M. <ma...@ma...> - 2006-07-05 14:44:38
|
Dietrich Streifert schrieb: > Hello List, > > I'm currently working on a projekt which uses HTML::Template. As a > development platform I use eclipse EPIC perl plugin and WTP. > > Does anyone know a way to configure the html editor to ignore the > HTML::Template tags without deactivating validation? > Or even better to allow the html editor to valdate the HTML::Template > syntax? > > Thank you for answering. > > Best regards... > > Hi Dietrich, how about using the comment-style-syntax like <!-- TMPL_VAR NAME=TESTVAR --> Described here: http://search.cpan.org/~samtregar/HTML-Template-2.8/Template.pm#NOTES regards, maaged |