html-template-users Mailing List for HTML::Template (Page 58)
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: Puneet K. <pk...@ei...> - 2004-02-20 03:58:29
|
A nice lesson here -- H::T set out to separate logic from display. Ever so often we itch to program just a tad bit more code in our presentation layer so we can "get away" with something, but by doing so we defeat the purpose of H::T. While 100% strict separation will never be possible (alternating colored rows in a table), and some logic may be necessary to avoid absolutely runaway explosion in template complexity and numbers, more often than not there is an elegant way around. Thanks Sam, for invaluable advice here. On Feb 19, 2004, at 7:50 PM, Sam Tregar wrote: > On Fri, 20 Feb 2004, Mathew Robertson wrote: > >> I often find myself generating template code such as: >> >> <TMPL_UNLESS error> >> <TMPL_UNLESS print> >> <TMPL_IF some_var> >> .... do something... >> </TMPL_IF> >> </TMPL_UNLESS> >> </TMPL_UNLESS> > > When I see stuff like that I go into my Perl code and whip up > something like: > > <tmpl_if no_error_and_no_print> > ... do something ... > </tmpl_if> > > <tmpl_if no_error> > ... do something else ... > > <tmpl_if error> > ... do something else entirely ... > </tmpl_if> > > That way the template stays simple and I concentrate the complex logic > in the Perl code where it belongs. If possible I try to find a way to > phrase each condition that doesn't involve boolean logic, which few > non-programmers fully understand. > >> The equivalent using H::T::E would be: >> >> <TMPL_UNLESS EXPR="((defined error) or (defined print)) and ...."> >> ... do something... >> </TMPL_UNLESS> > > You can write that a little simpler: > > <TMPL_UNLESS EXPR="((error or print) and ...)"> > >> both syntax's are reasonably ugly... > > Beauty is in the eye of the beholder... > >> What about a syntax like: >> >> <TMPL_IF !error,!print,some_var> > > ...which is proven by the fact that I find this much uglier than > either of the two alternatives! > > -sam > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Sam T. <sa...@tr...> - 2004-02-20 01:56:17
|
On Fri, 20 Feb 2004, Mathew Robertson wrote: > I often find myself generating template code such as: > > <TMPL_UNLESS error> > <TMPL_UNLESS print> > <TMPL_IF some_var> > .... do something... > </TMPL_IF> > </TMPL_UNLESS> > </TMPL_UNLESS> When I see stuff like that I go into my Perl code and whip up something like: <tmpl_if no_error_and_no_print> ... do something ... </tmpl_if> <tmpl_if no_error> ... do something else ... <tmpl_if error> ... do something else entirely ... </tmpl_if> That way the template stays simple and I concentrate the complex logic in the Perl code where it belongs. If possible I try to find a way to phrase each condition that doesn't involve boolean logic, which few non-programmers fully understand. > The equivalent using H::T::E would be: > > <TMPL_UNLESS EXPR="((defined error) or (defined print)) and ...."> > ... do something... > </TMPL_UNLESS> You can write that a little simpler: <TMPL_UNLESS EXPR="((error or print) and ...)"> > both syntax's are reasonably ugly... Beauty is in the eye of the beholder... > What about a syntax like: > > <TMPL_IF !error,!print,some_var> ...which is proven by the fact that I find this much uglier than either of the two alternatives! -sam |
From: Philip S T. <phi...@gm...> - 2004-02-19 08:11:51
|
Sometime on Feb 18, Hrvoje Nik¹iæ assembled some asciibets to say: > Later I did come across your HTML.Template, but I found that I > preferred some of the design and implementation choices I've made. > I'll list some examples that convinced me to stick with a separate > implementation: After looking at your template, I'd say that I like your design too. My design decisions were influenced by two factors prevalent at the time that it was written. - I only had access to jdk 1.1.8 - hence the choice of Hashtables - I was primarily a perl programmer with a need for a means to separate code and presentation in java - which is why it looks more like perl and less like java. I also liked that you had implemented filters. I'd meant to do it a long time ago, but just never got down to it, primarily because I didn't have a need for it. I find that most people use filters for just one purpose - to get this to work: <tmpl_include name="<tmpl_var filename>"> All the best to your project, maybe I'll contribute to it sometime. Philip -- Matter cannot be created or destroyed, nor can it be returned without a receipt. |
From: <hn...@xe...> - 2004-02-18 22:43:01
|
Philip S Tellis <phi...@gm...> writes: > Sometime on Feb 18, Hrvoje Niksic assembled some asciibets to say: > >> Allow me to announce the availability of a Java implementation of >> HTML::Template. The home page is at: >> >> http://htmltemplate.inet.hr/ > > Uh, there already was a java version of html template at > http://html-tmpl-java.sourceforge.net/ > > why start a new project? It's not new and, more importantly, it didn't start out as a fork. When I started writing Free Htmltemplate in 2002, I wasn't originally aware of your version. I even announced a release back in 2002: http://www.geocrawler.com/archives/3/23294/2002/10/0/9958609/ Later I did come across your HTML.Template, but I found that I preferred some of the design and implementation choices I've made. I'll list some examples that convinced me to stick with a separate implementation: * HTML.Template didn't seem to offer a caching facility. One of the strong points of Free Htmltemplate is the ability to request transparent caching of compiled templates (including optimizations like blind cache), but also to simply retrieve the CompiledTemplate object and use it later. * Free Htmltemplate is written with multithreaded environment in mind from the start. For example, the transparent caching code is careful to synchronize accesses to its data structures, while making sure that synchronization doesn't degrade into serialization through long-standing locks. * I had different ideas of what the translation of HTML::Template's API to Java should look like. For example, I don't have methods that accept Object[] arguments that closely follow Perl's subroutine call model. The Free Htmltemplate approach seems more "Java-like" to me, while retaining the spirit of the original API. This is surely deep in the realms of personal taste, but I invite you to take a look and judge for yourself. * I used the new API's such as Collections, Iterators, etc. and did not want to revert to Hashtables, Vectors, and Enumerations. This is a matter of taste as well. * My simple-minded benchmarks showed that my implementation was faster. This might simple be a consequence of the caching. None of this is meant as an argument that my program is in any way "better" than yours, just as an explanation of why I didn't just pick up your version when I became aware of it. |
From: <hn...@xe...> - 2004-02-18 21:58:09
|
Sam Tregar <sa...@tr...> writes: > If I wanted to run some benchmarks with your code what JVM should I > use? Simply use the latest revision of Sun's 1.4.x. That's what I use. |
From: Sam T. <sa...@tr...> - 2004-02-18 21:52:52
|
On Wed, 18 Feb 2004, [iso-8859-2] Hrvoje Nik?i? wrote: > Good point, I really should back up such a claim with numbers. I > originally didn't go out of my way to make Htmltemplate very fast, I > simply coded it the "obvious" way. But then I did some benchmarks > and, to my surprise, found it to be a good deal faster than I > expected. The benchmark was admittedly *very* simple-minded: take a > template, compile it once, and run the template transformation over > and over to see how many transformations per second I can squeeze. What kind of complexity did you put into your test template? I've found that deep loops with plenty of IF/ELSE logic are a good way to stress HTML::Template. > The code generated by HTML::Template::JIT still contains calls to > Perl's library and object system, doesn't it? To me that's quite > different from typical hand-written C code, which I'd expect to always > beat Java by a wide margin. It makes a few, mostly to get param values from SVs, but it makes a lot fewer than you might imagine. The template text itself and all the branching and looping logic is compiled into pure C code. > How do you benchmark HTML::Template::JIT? I can try to repeat the > same benchmark with Free Htmltemplate to see if I still get the > speedup I got when I last compared them. I use a script called benchmark.pl in the scripts/ directory of the HTML::Template::JIT distribution. It uses Benchmark.pm in a fairly standard fashion. If I wanted to run some benchmarks with your code what JVM should I use? I think I have some version of Sun's 1.4 JRE installed but I seem to remember something about it not being very fast. -sam |
From: Philip S T. <phi...@gm...> - 2004-02-18 21:20:33
|
Sometime on Feb 18, Hrvoje Niksic assembled some asciibets to say: > Allow me to announce the availability of a Java implementation of > HTML::Template. The home page is at: > > http://htmltemplate.inet.hr/ Uh, there already was a java version of html template at http://html-tmpl-java.sourceforge.net/ why start a new project? Philip -- All men know the utility of useful things; but they do not know the utility of futility. -- Chuang-tzu |
From: <hn...@xe...> - 2004-02-18 21:05:08
|
Sam Tregar <sa...@tr...> writes: > On Wed, 18 Feb 2004, Hrvoje Niksic wrote: > >> Allow me to announce the availability of a Java implementation of >> HTML::Template. The home page is at: >> >> http://htmltemplate.inet.hr/ > > Wow, great work! I love the website and your excellent > documentation. Thanks! > I do, however, have a bone to pick. You claim your system is much > faster than HTML::Template and HTML::Template::JIT: > > Free htmltemplate is significantly faster than HTML::Template in > rendering pre-compiled templates. Even with the JIT in place, > which according to Sam speeds up template rendering by a factor > of 4 to 8, htmltemplate might still be as fast or faster. > > Can you back this up with numbers? Good point, I really should back up such a claim with numbers. I originally didn't go out of my way to make Htmltemplate very fast, I simply coded it the "obvious" way. But then I did some benchmarks and, to my surprise, found it to be a good deal faster than I expected. The benchmark was admittedly *very* simple-minded: take a template, compile it once, and run the template transformation over and over to see how many transformations per second I can squeeze. The result was astounding 3000 renderings per second, which was totally beyond my expectations. I first thought that I did something wrong, that the code wasn't even running, but adding the output showed that I was indeed producing the intended output 3000 times in a row in about 1 second. If my memory serves me, the same kind of benchmark showed HTML::Template performing about 300 renderings per second. The reasoning that follows is summed up by the above paragraph: if JIT speeds up HTML::Template 8 times, Htmltemplate might still be faster. But I really haven't checked it. I guess I should reword that paragraph to make it clear that it's based on speculation and not on actual measurements of HTML::Template::JIT's performance. > Java has improved a great deal, granted, but I'd be pretty shocked > if it could beat the highly-optimized C code generated by > HTML::Template::JIT. The code generated by HTML::Template::JIT still contains calls to Perl's library and object system, doesn't it? To me that's quite different from typical hand-written C code, which I'd expect to always beat Java by a wide margin. How do you benchmark HTML::Template::JIT? I can try to repeat the same benchmark with Free Htmltemplate to see if I still get the speedup I got when I last compared them. |
From: Sam T. <sa...@tr...> - 2004-02-18 19:20:49
|
On Wed, 18 Feb 2004, Hrvoje Niksic wrote: > Allow me to announce the availability of a Java implementation of > HTML::Template. The home page is at: > > http://htmltemplate.inet.hr/ Wow, great work! I love the website and your excellent documentation. Feel free to make announcements of new versions on the list. I do, however, have a bone to pick. You claim your system is much faster than HTML::Template and HTML::Template::JIT: Free htmltemplate is significantly faster than HTML::Template in rendering pre-compiled templates. Even with the JIT in place, which according to Sam speeds up template rendering by a factor of 4 to 8, htmltemplate might still be as fast or faster. Can you back this up with numbers? Java has improved a great deal, granted, but I'd be pretty shocked if it could beat the highly-optimized C code generated by HTML::Template::JIT. -sam |
From: Hrvoje N. <hn...@xe...> - 2004-02-18 18:15:35
|
Allow me to announce the availability of a Java implementation of HTML::Template. The home page is at: http://htmltemplate.inet.hr/ I apologize in advance for the off-topicness of this announcement. Questions and discussion should be directed to me, unless they also concern HTML::Template. New versions will not be announced here, the only purpose of this announcement is to alert people to the existence of another HTML::Template implementation. If you are forced or prefer to work in Java and would like to use HTML::Template templates from your Servlets, this might be the thing for you: * Free Htmltemplate's API is designed to be familiar to users of HTML::Template, although the naming is more suited to Java. * The template syntax is intended to be 100% compatible with HTML::Template. Where differences exist, they are documented -- see http://htmltemplate.inet.hr/deviations.html . * Free Htmltemplate is currently licensed under the GNU GPL. If you like it and would like to use it in commercial projects, let me know and I'll consider changing the license to LGPL or to something BSD-like. Please note that Free Htmltemplate has nothing to do with the HTML.Template written by Philip Tellis, also in Java. |
From: Joel <htm...@jo...> - 2004-02-17 23:18:03
|
>On Tue, 17 Feb 2004, Joel wrote: > >The problem I had with Ikonboard was that it didn't do any file >locking...get two posts simultaneously and they'd stomp all over each >other. Shades of Matt's WWWBoard. Of course, that was a couple of >years ago, so it may have matured since then, and probably has. > I think I know what you mean by stomping and given a DBM situation, I can see that happening. You'd have a problem with the bit of code that gets the next ID for an incoming post. There's a definite concurrency issue there if you don't have something intelligent. I do not know if they have resolved that.=20 Using it with MySQL would eliminate such a problem given that the database is built to accomodate such a situation. (Insert two rows at the 'same time' and you'll still get two IDs from the database) =46or the record, we've only ever used it in a database. It just makes sense. --Joel (Let's see if my text wraps properly this time.) |
From: Karen J. C. <si...@ph...> - 2004-02-17 23:01:38
|
On Tue, 17 Feb 2004, Joel wrote: J>It's also FREE, which is an added bonus for all the features it provides. The J>only thing it doesn't do which I wish it did is to act as an archive for J>mailing lists and the like, but I figure I can hack up a script to add stuff J>like that to the database directly. The problem I had with Ikonboard was that it didn't do any file locking... get two posts simultaneously and they'd stomp all over each other. Shades of Matt's WWWBoard. Of course, that was a couple of years ago, so it may have matured since then, and probably has. -- Karen J. Cravens si...@ph... |
From: Karen J. C. <si...@ph...> - 2004-02-17 22:55:25
|
On Tue, 17 Feb 2004, P Kishor wrote: PK> It was fun being at OSCON when this beast was born... Aw, rub it in, whydoncha? -- Karen J. Cravens si...@ph... |
From: Joel <htm...@jo...> - 2004-02-17 22:39:28
|
Hi all, We use ikonBoard, http://www.ikonboard.com, a free message boards system th= at runs off of DBM or MySQL.=20 It does NOT use HTML::Template, but it IS written in Perl and it's quite ni= ce. It's extremely extensible using the administrative control panel. You basic= ally have the ability to edit 99% of the HTML that is presented to the user.=20 It's also FREE, which is an added bonus for all the features it provides. T= he only thing it doesn't do which I wish it did is to act as an archive for mailing lists and the like, but I figure I can hack up a script to add stuf= f like that to the database directly. --Joel >Hi, > >I was wondering if anyone knew of a open-source >bulletin board that uses HTML::TMPL? > >I think it would make customizing much more simple. > >thanks, > >--paul > >__________________________________ >Do you Yahoo!? >Yahoo! Finance: Get your refund fast by filing online. >http://taxes.yahoo.com/filing.html > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick >_______________________________________________ >Html-template-users mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: P K. <pk...@ei...> - 2004-02-17 22:39:14
|
Karen J. Cravens wrote: >On Tue, 17 Feb 2004, Paul B. Giese wrote: > >PBG>I was wondering if anyone knew of a open-source >PBG>bulletin board that uses HTML::TMPL? > >And a Wiki, and a Mhonarc replacement, and a blogger, too. Oh, and a >pony. > >(I'm writing all of the above (except the pony), since I haven't found one >yet.) > > > no problem about the last one... the good folks at Fotango are... It was fun being at OSCON when this beast was born... http://www.poniecode.org/ ;-) |
From: Karen J. C. <si...@ph...> - 2004-02-17 22:24:32
|
On Tue, 17 Feb 2004, Paul B. Giese wrote: PBG>I was wondering if anyone knew of a open-source PBG>bulletin board that uses HTML::TMPL? And a Wiki, and a Mhonarc replacement, and a blogger, too. Oh, and a pony. (I'm writing all of the above (except the pony), since I haven't found one yet.) -- Karen J. Cravens si...@ph... |
From: Paul B. G. <pb...@ya...> - 2004-02-17 22:12:38
|
Hi, I was wondering if anyone knew of a open-source bulletin board that uses HTML::TMPL? I think it would make customizing much more simple. thanks, --paul __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html |
From: Joel <htm...@jo...> - 2004-02-17 20:04:21
|
Hi Lori, In your loop where you are pushing onto @loop_data, you'd want to add an additional variable to your hashref that will indicate whether or not is drillable. So inside your loop, you might do something like this: for (some_loop_condition) { if (row_is_drillable) { push @loop_data, {id =3D> $this, rowname =3D> $that, drillable =3D> 1} } else { push @loop_data, {id =3D> $this, rowname =3D> $that, drillable =3D> 0} =20 } } $tmpl->param(LOOP_DATA =3D> \@loop_data); Then inside your template: <TMPL_LOOP NAME=3DLOOP_DATA> ID: <TMPL_VAR NAME=3DID><br> Name: <TMPL_VAR NAME=3DROWNAME><br> Drillable?: <TMPL_IF NAME=3DDRILLABLE>Yes<TMPL_ELSE>No</TMPL_IF> </TMPL_LOOP> Basically, you can use TMPL_IF on any variable in your loop. Although, if a drillable row requires a URL or some other bit of information, you can get = away without an explicit drillable variable and use the presence or absence of t= he URL to indicate if the row is drillable. Remember what true and false are in perl and that will help you. False is 0 (the numeric value), "0" (a string containing the number 0), undef (undefin= ed) or a empty string ('' or ""). Anything else is true. And that's how HTML::Tempalte works, as well, when dealing with TMPL_IF. Clear as mud, right? :) Hope this helps. Good luck! --Joel >I've read the documentation sections on TMPL_IF and TMPL_ELSE. The part >where I'm getting stuck is figuring out how to set up that "BOOL" value. = I >know if "BOOL" is true, then the section in TMPL_IF is run; if it's false, >the section in TMPL_ELSE is run. This sounds like what I want to do (I >think...). >=20 >I have my results generated and the web page looks nice. However, there a= re >some rows that need to have a different bit of HTML in it (some rows/cells >are to be "drillable" and some are not). Unfortunately, it's not just the >"last" or "first", etc.; the rows are interspersed in no particular order, >some are contiguous, some are stand-alone. >=20 >This is where I get stuck. I can tell where I am in Perl when I'm pushing >the hash references to the @loop_data (which is subsequently pushed to the >template for output), so I can set a variable to something at that time. = =20 >=20 >How do I set up a variable that the TMPL_IF and TMPL_ELSE can use to >determine which section of the HTML loop to process? >=20 >I hope this made sense. When you're new, sometimes it's hard to know even >how to ask a question! :-) >=20 >Thanks! >=20 >Lori > > >--------------------------------- >Do you Yahoo!? >Yahoo! Finance: Get your refund fast by filing online |
From: Roger B. W. <ro...@fi...> - 2004-02-17 20:00:12
|
On Tue, Feb 17, 2004 at 11:32:43AM -0800, LDT wrote: >How do I set up a variable that the TMPL_IF and TMPL_ELSE can use to determine which section of the HTML loop to process? Set a new variable in the hash that forms the entry in @loop_data. Set it to "1" for the special mode, and don't set it at all (or set it to "" or 0) for the normal mode. If you post code fragments I'll show you how this can be done. Without seeing your specific coding style, I can't do any better than the various examples that are in the list archive. Roger |
From: Timm M. <tm...@ag...> - 2004-02-17 19:54:41
|
You set it up just like a TMPL_VAR. If the value of that variable is true (according to Perl's definition of truth), then that section is run. It's just like doing: if($var) { # Do something } else { # Do something else } Except HTML::Template (in its basic form) doesn't provide a way of doing elsif or doing complex comparisons (like $var == 3). At 11:32 AM 2/17/04 -0800, LDT wrote: >I've read the documentation sections on TMPL_IF and TMPL_ELSE. The part >where I'm getting stuck is figuring out how to set up that "BOOL" >value. I know if "BOOL" is true, then the section in TMPL_IF is run; if >it's false, the section in TMPL_ELSE is run. This sounds like what I want >to do (I think...). > >I have my results generated and the web page looks nice. However, there >are some rows that need to have a different bit of HTML in it (some >rows/cells are to be "drillable" and some are not). Unfortunately, it's >not just the "last" or "first", etc.; the rows are interspersed in no >particular order, some are contiguous, some are stand-alone. > >This is where I get stuck. I can tell where I am in Perl when I'm pushing >the hash references to the @loop_data (which is subsequently pushed to the >template for output), so I can set a variable to something at that time. > >How do I set up a variable that the TMPL_IF and TMPL_ELSE can use to >determine which section of the HTML loop to process? > >I hope this made sense. When you're new, sometimes it's hard to know even >how to ask a question! :-) > >Thanks! > >Lori > > >Do you Yahoo!? >Yahoo! Finance: ><http://us.rd.yahoo.com/evt=22055/*http://taxes.yahoo.com/filing.html>Get >your refund fast by filing online |
From: P K. <pk...@ei...> - 2004-02-17 19:51:14
|
LDT wrote: > I've read the documentation sections on TMPL_IF and TMPL_ELSE. The > part where I'm getting stuck is figuring out how to set up that "BOOL" > value. I know if "BOOL" is true, then the section in TMPL_IF is run; > if it's false, the section in TMPL_ELSE is run. This sounds like what > I want to do (I think...). > > I have my results generated and the web page looks nice. However, > there are some rows that need to have a different bit of HTML in it > (some rows/cells are to be "drillable" and some are not). > Unfortunately, it's not just the "last" or "first", etc.; the rows are > interspersed in no particular order, some are contiguous, some are > stand-alone. you will have to set up some variable that is present in every row, and then set that variable to 1 or 0... @rows = ( {drillable=>0......}, {drillable=>0......}, {drillable=>1......} ); then, in your loop <tmpl_loop rows> <tmpl_if drillable>print drillable cells<tmpl_else>print cells</tmpl_if> </tmpl_loop> |
From: LDT <per...@ya...> - 2004-02-17 19:37:15
|
I've read the documentation sections on TMPL_IF and TMPL_ELSE. The part where I'm getting stuck is figuring out how to set up that "BOOL" value. I know if "BOOL" is true, then the section in TMPL_IF is run; if it's false, the section in TMPL_ELSE is run. This sounds like what I want to do (I think...). I have my results generated and the web page looks nice. However, there are some rows that need to have a different bit of HTML in it (some rows/cells are to be "drillable" and some are not). Unfortunately, it's not just the "last" or "first", etc.; the rows are interspersed in no particular order, some are contiguous, some are stand-alone. This is where I get stuck. I can tell where I am in Perl when I'm pushing the hash references to the @loop_data (which is subsequently pushed to the template for output), so I can set a variable to something at that time. How do I set up a variable that the TMPL_IF and TMPL_ELSE can use to determine which section of the HTML loop to process? I hope this made sense. When you're new, sometimes it's hard to know even how to ask a question! :-) Thanks! Lori --------------------------------- Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online |
From: Sam T. <sa...@tr...> - 2004-02-17 18:50:05
|
On Mon, 16 Feb 2004, Andy Pearce wrote: > HTML::Template->new() : Unknown or unmatched TMPL construct (T0B5 This is an indication that you have a broken Perl install, most likely 5.8.0 or 5.8.1 on Redhat 8 or Redhat 9. Upgrade to 5.8.3 and this problem will go away. -sam |
From: Philip S T. <phi...@gm...> - 2004-02-17 15:14:14
|
Sometime Today, Kapoor, Nishikant assembled some asciibets to say: > I am looking to generate an event calendar using H::T. Can anyone help > me with some pointers? code snippets? http://sourceforge.net/projects/calendar-pm - get the code from CVS. It isn't necessarily well written, but it does a job. We used to use it for course schedules, then it turned to a birthday tracker. Philip -- Dying is one of the few things that can be done as easily lying down. -- Woody Allen |
From: Joel <htm...@jo...> - 2004-02-17 15:08:53
|
Why reinvent the wheel? Sure, HTML::Template is a fantastic module and is q= uite versatile, but coding up an accurate calendar is by no means a simple task.= =20 I recently discovered HTML::CalendarMonthSimple and found it to be extremel= y useful and easy to use. Combine it with HTML::Template and you have somethi= ng good going there (this is untested code): cal.pl ------ #!/usr/bin/perl -w=20 use HTML::CalendarMonthSimple; use HTML::Template; my $template =3D HTML::Template->new(filename =3D> 'cal.html'); my $cal =3D new HTML::CalendarMonthSimple('month' =3D> '2', 'year' =3D> '20= 04'); # Format the calendar $cal->width("100%"); $cal->border(1); $cal->bgcolor("#006633"); # Other calendar formatting is available, read perldoc for more info # Set some content in the calendar $cal->addcontent(2, "Groundhog Day!") $cal->addcontent(14, "Valentine's Day!") $template->param(CALENDAR =3D> $cal->as_HTML); print "Content-Type: text/html\r\\r\n"); print $template->output; cal.html -------- <HTML> <BODY> <TMPL_VAR NAME=3DCALENDAR> </BODY> </HTML> It doesn't get much simpler than that. Supply your own month/year to HTML::CalendarMonthSimple and you can do just about anything. Additionally, HTML::CalendarMonthSimple has the ability to place HTML, link= s and other text in each day of the calendar ($cal->addcontent), read the doc= s for more information. It's quite easy. --Joel >Sorry if this post is off-topic but I have a feeling people in this list = =3D >would have definitely come across it. > >I am looking to generate an event calendar using H::T. Can anyone help =3D >me with some pointers? code snippets? > >I did search the archives but could not find much info. > >Thanks, >Nishi > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick >_______________________________________________ >Html-template-users mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/html-template-users |