html-template-users Mailing List for HTML::Template (Page 106)
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: Glenn M. <Gl...@Mo...> - 2002-06-28 13:39:55
|
Hi David Thanks for that, I knew I couldn't be the only one. Cheers Glenn |
From: David K. <da...@gi...> - 2002-06-28 12:46:41
|
"Glenn Morgan" <Gl...@Mo...> wrote: > > I am using HTML::Template with PageKit and having a problem with > <tmpl_var> substitutions in javascript quoted strings...[snip] > > Unfortunately, > > 1) I am working with db data and am not aware of what chars data values > contain. > > 2) I am using the same data values in different places within the same > template and do not want escaped quotes in all cases. > > These two cases make it very messy to filter my datasets and escape > here, there and everywhere. > > Any ideas? Is there a simple solution or would a escape=quotes patch be > the way to go? i have had this problem, too. in addition to single and double quotes, Javascript literal strings cannot contain carriage returns, linefeeds, and (depending on the browser) tabs, either. and i also had output HTML that needed the value both ways, depending on where it was used in the document. in my case, i needed the value "JS-ESCAPED" to populate a data validation function, and HTML-ESCAPED elsewhere in the document for display. so i patched HTML::Template (v. 2.4) to add escape="JS" for that project. I never submitted the patch because 2.5 had already been released, and i kept meaning to make the patch for that latest version, but here, if it helps, is the patch i made for 2.4. maybe Sam will incorporate the patch in the next release, since we now share a common ex-boss :-) -dave |
From: Cory T. <ct...@on...> - 2002-06-28 11:53:54
|
> -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of > Philip S Tellis > Sent: Friday, June 28, 2002 5:31 AM > To: HTML::Template List > Subject: RE: [htmltmpl] (no subject) > > > On Fri, 28 Jun 2002, Chris Davies wrote: > > > Presumably you use DBI to get the data from your database. DBI > provides an > > "escape the quotes" operation for strings containing single quotes. You > > could perhaps use that to process your data prior to giving it to H::T > > except, the way DBI escapes single quotes is by using a second quote: > > ' -> '' > > for most databases at least. As far as I know, this is a function (for both 'neat' and 'quote') that has behavior dependent on the DBD loaded by DBI. -- Cory |
From: Glenn M. <Gl...@Mo...> - 2002-06-28 10:13:24
|
Hi Chris >Presumably you use DBI to get the data from your database. DBI provides >an "escape the quotes" operation for strings containing single quotes. >You could perhaps use that to process your data prior to giving it to >H::T Do you mean the 'neat' or 'quote' methods of DBI? 'neat' doesn't escape single quotes contained in within a string. 'quote' does escape them but with another single quote and anyway is for tidying data for input. At least, that is how I understand it. >Interesting. Looks like an escape=quotemeta may be in order here. This >seems like something others might encounter at some point, so maybe it >should be added to HTML::Template. Unless I missing something, I agree with you Philip. If I have a template like this: tmpl_str = "It's a wonderful life"; <button onclick="javascript: js_str='<tmpl_var name="tmpl_str">';"><tmpl_var name="tmpl_str"></button> I end up with HTML like this: <button onclick="javascript: js_str='It's a wonderful life';">It's a wonderful life</button> The js_str is obviously broken but the inline text of the <button> is fine. I have thought about preping my data before sending it to htmltmpl and will obviously have to do that if I can't find a neat work around. It's going to be a pain though. I either extract an escaped and unescaped version of the same value from my db or mash the dataset around before passing it on to htmltmpl. To my mind it is the placement of the <tmpl_var> that is the deciding factor on whether to escape or not. In which case I would like to be able to say <tmpl_var escape=quote> or some such syntax. Cheers Glenn |
From: Chris D. <Chr...@Ma...> - 2002-06-28 10:10:21
|
Duh! Sorry Chris -- Chris Davies, Manheim Online Tel. 0113 393-2004 Fax. 0870 444-0482. Mobile 07778 199069 -----Original Message----- From: htm...@li... [mailto:htm...@li...]On Behalf Of Philip S Tellis Sent: Friday, June 28, 2002 10:31 AM To: HTML::Template List Subject: RE: [htmltmpl] (no subject) On Fri, 28 Jun 2002, Chris Davies wrote: > Presumably you use DBI to get the data from your database. DBI provides an > "escape the quotes" operation for strings containing single quotes. You > could perhaps use that to process your data prior to giving it to H::T except, the way DBI escapes single quotes is by using a second quote: ' -> '' for most databases at least. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Caffeinated soap. No kidding. http://thinkgeek.com/sf _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Philip S T. <phi...@gm...> - 2002-06-28 09:36:41
|
On Fri, 28 Jun 2002, Chris Davies wrote: > Presumably you use DBI to get the data from your database. DBI provides an > "escape the quotes" operation for strings containing single quotes. You > could perhaps use that to process your data prior to giving it to H::T except, the way DBI escapes single quotes is by using a second quote: ' -> '' for most databases at least. |
From: Chris D. <Chr...@Ma...> - 2002-06-28 09:15:01
|
Presumably you use DBI to get the data from your database. DBI provides an "escape the quotes" operation for strings containing single quotes. You could perhaps use that to process your data prior to giving it to H::T Chris -- Chris Davies, Manheim Online Tel. 0113 393-2004 Fax. 0870 444-0482. Mobile 07778 199069 -----Original Message----- From: htm...@li... [mailto:htm...@li...]On Behalf Of Glenn Morgan Sent: Friday, June 28, 2002 6:47 AM To: htm...@li... Subject: [htmltmpl] (no subject) Hi Had a search through the archive but can't find what I'm looking for, so here goes. I am using HTML::Template with PageKit and having a problem with <tmpl_var> substitutions in javascript quoted strings. See below: <button onclick="javascript: js_str='<tmpl_var name="tmpl_str">;"></button> If tmpl_str="It's a wonderful life" Then my resultant html is <button onclick="javascript: js_str='It's a wonderful life'";></button> This is obviously broken due to the unescaped single quote in It's. The same would apply if the js string assignment was enclosed in double quotes and I included doulble quotes in my tmp_str value. What I really need to do is: tmpl_str=It\'s a wonderful life and all would be well. Unfortunately, 1) I am working with db data and am not aware of what chars data values contain. 2) I am using the same data values in different places within the same template and do not want escaped quotes in all cases. These two cases make it very messy to filter my datasets and escape here, there and everywhere. Any ideas? Is there a simple solution or would a escape=quotes patch be the way to go? Thanks in advance Glenn ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Caffeinated soap. No kidding. http://thinkgeek.com/sf _______________________________________________ Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Philip S T. <phi...@gm...> - 2002-06-28 05:56:04
|
On Fri, 28 Jun 2002, Glenn Morgan wrote: > I am using HTML::Template with PageKit and having a problem with > <tmpl_var> substitutions in javascript quoted strings. See below: > > <button onclick="javascript: js_str='<tmpl_var > name="tmpl_str">;"></button> > > If tmpl_str="It's a wonderful life" > > Then my resultant html is > > <button onclick="javascript: js_str='It's a wonderful life'";></button> Interesting. Looks like an escape=quotemeta may be in order here. This seems like something others might encounter at some point, so maybe it should be added to HTML::Template. Philip |
From: Glenn M. <Gl...@Mo...> - 2002-06-28 05:47:17
|
Hi Had a search through the archive but can't find what I'm looking for, so here goes. I am using HTML::Template with PageKit and having a problem with <tmpl_var> substitutions in javascript quoted strings. See below: <button onclick="javascript: js_str='<tmpl_var name="tmpl_str">;"></button> If tmpl_str="It's a wonderful life" Then my resultant html is <button onclick="javascript: js_str='It's a wonderful life'";></button> This is obviously broken due to the unescaped single quote in It's. The same would apply if the js string assignment was enclosed in double quotes and I included doulble quotes in my tmp_str value. What I really need to do is: tmpl_str=It\'s a wonderful life and all would be well. Unfortunately, 1) I am working with db data and am not aware of what chars data values contain. 2) I am using the same data values in different places within the same template and do not want escaped quotes in all cases. These two cases make it very messy to filter my datasets and escape here, there and everywhere. Any ideas? Is there a simple solution or would a escape=quotes patch be the way to go? Thanks in advance Glenn |
From: Glenn M. <Gl...@Mo...> - 2002-06-28 05:00:01
|
Hi Had a search through the archive but can't find what I'm looking for, so here goes. I am using HTML::Template with PageKit and having a problem with <tmpl_var> substitutions in javascript quoted strings. See below: <button onclick="javascript: js_str='<tmpl_var name="tmpl_str">;"></button> If tmpl_str="It's a wonderful life" Then my resultant html is <button onclick="javascript: js_str='It's a wonderful life'";></button> This is obviously broken due to the unescaped single quote in It's. The same would apply if the js string assignment was enclosed in double quotes and I included doulble quotes in my tmp_str value. What I really need to do is: tmpl_str=It\'s a wonderful life and all would be well. Unfortunately, 1) I am working with db data and am not aware of what chars data values contain. 2) I am using the same data values in different places within the same template and do not want escaped quotes in all cases. These two cases make it very messy to filter my datasets and escape here, there and everywhere. Any ideas? Is there a simple solution or would a escape=quotes patch be the way to go? Thanks in advance Glenn |
From: Sam T. <sa...@tr...> - 2002-06-26 15:52:50
|
On 26 Jun 2002, Tugrul Galatali wrote: > It seems that TMPL_LOOP doesn't obey global_vars. I attached a fix that > borrows code from variable handling, but I'm not completely comfortable > with C code interfacing with perl so :) Well, that's not a documented feature of HTML::Template. Note that the options is called "global_VARS". The fact that it affects loops too is somewhat accidental, and not fully implemented. -sam |
From: Tugrul G. <tu...@ga...> - 2002-06-26 14:47:13
|
It seems that TMPL_LOOP doesn't obey global_vars. I attached a fix that borrows code from variable handling, but I'm not completely comfortable with C code interfacing with perl so :) tugrul@gandalf:~/HT_Bug$ ./test.pl HTML::Template 2.5 ---------------------------------------------------------------------- Outside loop: B_VAR Inside loop: B_VAR; C_VAR_INLOOP1 Inner loop: B_VAR; C_VAR_INLOOP1 Inner loop: B_VAR; C_VAR_INLOOP2 Inside loop: B_VAR; C_VAR_INLOOP2 Inner loop: B_VAR; C_VAR_INLOOP1 Inner loop: B_VAR; C_VAR_INLOOP2 ---------------------------------------------------------------------- HTML::Template::JIT 0.03 ---------------------------------------------------------------------- Outside loop: B_VAR Inside loop: B_VAR; C_VAR_INLOOP1 Inside loop: B_VAR; C_VAR_INLOOP2 ---------------------------------------------------------------------- |
From: Chris D. <Chr...@Ma...> - 2002-06-26 09:08:34
|
On Mon, Jun 24, 2002 at 08:35:25AM -0700, Roy Rubin wrote: >I am looking to >use the refernces that are already part of the DBI, instead of hard coding >the variables (as in $OfficeID, etc.) I hope this makes sense. On Monday, June 24, 2002 4:47 PM:Roger Burton West [mailto:ro...@fi...] replied: > my @l1; > my $sth=$dbh->prepare("SELECT blah blah ... "); > $sth->execute; > while (my $r=$sth->fetchrow_hashref) { > # manipulate $r if desired, for example by adding an inner loop: > $r->{something_not_in_database}=$something_else; > # once all manipulation is done: > push @l1,$r; > } I don't believe that this example will work with new(er) versions of DBI, as the documentation states: Currently, a new hash reference is returned for each row. This will change in the future to return the same hash ref each time, so don't rely on the current behaviour. Consequently you would need to generate a new hash: push @l1, { %$r }; Incidentally, you can make your database queries *much* more efficient by moving the prepare statements outside your loops, and using placeholder queries. To take your original example, this could be rewritten thus: my $sqlOffice = qq{SELECT OfficeID, OfficeLocation FROM Office}; my $sthOffice = $dbh->prepare($sqlOffice) or bail_out($self); my $sqlEmp = qq{Select ID from Employees WHERE Office = ?}; my $sthEmp = $dbh->prepare($sqlEmp) or bail_out($self); my $sthOffice->execute() or bail_out($self); #outer loop my @Offices; while (my ($OfficeID, $OfficeLocation) = $sthOffice->fetchrow_array()) { $sthEmp->execute($OfficeID) or bail_out($self); my @whatever; #inner loop while (my ($ID) = $sth1->fetchrow_array()) { push @whatever, {ID => $ID}; } push @Offices, {OfficeLocation => $OfficeLocation, EmpNames => \@whatever}; } $thtml->param(OFFICES => \@Offices); Chris -- Chris Davies, Manheim Online Tel. 0113 393-2004 Fax. 0870 444-0482. Mobile 07778 199069 |
From: Roy R. <ro...@ir...> - 2002-06-24 15:07:11
|
Hello, Can someone provide an example of nested loops. I have it working, but I am using *bad* code because I have had problems with referencing. Thanks. Roy ro...@ir... > I sent the post to both lists - not sure which one is currently live. |
From: Tatsuhiko M. <miy...@ed...> - 2002-06-24 03:56:41
|
At Sat, 22 Jun 2002 15:56:12 -0400 (EDT), Sam Tregar wrote: > > This patch allows you to do > > > > HTML::Template->new(default_escape => 'HTML'); > > > > then your TMPL_VARs will always be HTML-escaped unless you explicitly > > specify ESCAPE=0, which will be a handy guard against Cross Site > > Scripting attacks. > > Looks good to me. All it needs now is some documentation. I'll do the > English if you'll do the Japanese. Surely, will do ;-) -- Tatsuhiko Miyagawa <miy...@ed...> |
From: Sam T. <sa...@tr...> - 2002-06-24 00:10:34
|
On 23 Jun 2002, Tugrul Galatali wrote: > On Sat, 2002-06-22 at 15:54, Sam Tregar wrote: > > I disagree. Ternary logic (where there are three logical values true, > > false and unknown) is NOT commonly understood by non-programmers. Thus, I > > don't think this is a good candidate for the default syntax. > > Three values? I'm only thinking two here, exists and does not exist. Oh. I assumed you were proposing we add support for a defined()-type operator. That would give the template syntax a ternary logic. > Now that I've read the code, the thing is that you already check if > something is defined, and then you check if its true. I just want to be > able to turn off the check if its true. I don't care if its true or > false, just if it exists. I guess you should use a private patch then. I don't see this as a general enough need to make it worth adding to HTML::Template. > Also, does the H::T::Expr solution work with JIT? Not yet. I intend to add support sometime after I finish support for all of HTML::Template's options. -sam |
From: Tugrul G. <tu...@ga...> - 2002-06-23 23:55:54
|
On Sat, 2002-06-22 at 15:54, Sam Tregar wrote: > I disagree. Ternary logic (where there are three logical values true, > false and unknown) is NOT commonly understood by non-programmers. Thus, I > don't think this is a good candidate for the default syntax. Three values? I'm only thinking two here, exists and does not exist. > However, it's easy to do with HTML::Template::Expr. If you don't like > writing <tmpl_if expr="defined(foo)"> then just write a filter to change > "<tmpl_if_defined foo>" (or whatever you like) into it. Now that I've read the code, the thing is that you already check if something is defined, and then you check if its true. I just want to be able to turn off the check if its true. I don't care if its true or false, just if it exists. I don't see the point in taking whatever performance hit/complexity filters and H::T::Expr introduce when what I want is already there :) Also, does the H::T::Expr solution work with JIT? Tugrul Galatali |
From: Sam T. <sa...@tr...> - 2002-06-22 20:48:09
|
On Fri, 21 Jun 2002, Douglas Kirkland wrote: > The problem I see with that, is if the TMPL_IF is reading the data. we > should be able to see if the data equal a value. If that is a case then > there should be something like this: > > <TMPL_IF NAME="FOO" eq 5> Use HTML::Template::Expr and spell that: <tmpl_if expr="foo eq 5"> And your wish is granted. But don't you really mean: <tmpl_if expr="foo == 5"> ? -sam |
From: Sam T. <sa...@tr...> - 2002-06-22 20:45:13
|
On Fri, 21 Jun 2002, Tatsuhiko Miyagawa wrote: > This patch allows you to do > > HTML::Template->new(default_escape => 'HTML'); > > then your TMPL_VARs will always be HTML-escaped unless you explicitly > specify ESCAPE=0, which will be a handy guard against Cross Site > Scripting attacks. Looks good to me. All it needs now is some documentation. I'll do the English if you'll do the Japanese. -sam |
From: Sam T. <sa...@tr...> - 2002-06-22 20:43:46
|
On 20 Jun 2002, Tugrul Galatali wrote: > And I feel that ifdefined is fundamentally simple enough (almost > simpler than if true since its almost not even logic) that it should be > included. I disagree. Ternary logic (where there are three logical values true, false and unknown) is NOT commonly understood by non-programmers. Thus, I don't think this is a good candidate for the default syntax. However, it's easy to do with HTML::Template::Expr. If you don't like writing <tmpl_if expr="defined(foo)"> then just write a filter to change "<tmpl_if_defined foo>" (or whatever you like) into it. -sam |
From: Phil T. <phi...@bi...> - 2002-06-22 09:37:39
|
UHJvYmxlbSB3YXMgZml4ZWQgaW4gYSBsYXRlciB2ZXJzaW9uIC0gdGhhbmtzIGFueXdheQ0KDQpw aGlsDQotLS0tLSBPcmlnaW5hbCBNZXNzYWdlIC0tLS0tIA0KRnJvbTogIlBoaWwgVGF5bG9yIiA8 cGhpbC50YXlsb3JAYmlnZm9vdC5jb20+DQpUbzogPEh0bWwtdGVtcGxhdGUtdXNlcnNAbGlzdHMu c291cmNlZm9yZ2UubmV0Pg0KU2VudDogMjEgSnVuZSAyMDAyIDIyOjUyDQpTdWJqZWN0OiBbaHRt bHRtcGxdIFRNUExfTE9PUCBFcnJvcg0KDQoNCj4gSSBhbSBnZXR0aW5nIHRoZSBlcnJvciBiZWxv dywgSSB3b3VsZCBiZSBncmF0ZWZ1bCBpZiBzb21lYm9keSBjb3VsZCBleHBsYWluIHRoZSBwcm9i bGVtLiBJIGhhdmUgYWxzbyBhdHRhY2h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JlbWF0dXJlIGVuZCBvZiBzY3JpcHQgaGVhZGVyczogL3Zhci93d3cvY2dpLWJp bi9jb250cm9sLmNnaQ0KPiANCj4gDQo= |
From: Tugrul G. <tu...@ga...> - 2002-06-21 23:44:35
|
Since nobody bothered answering my question on how best to implement this option, I decided to add to the long list of flags than the short list of tags :) The changes were relatively simple, and seems to work just fine with my site. Comments on the implementation of the patch welcome. Tugrul Galatali |
From: Brian M. <bm...@pa...> - 2002-06-21 22:37:44
|
As mentioned briefly in this thread already, you can do this with HTML::Template::Expr. And you don't have to export booleans or anything like that, you can just use "defined," which works just like the perl function "defined" and happens to be one of the functions available in HTML::Template::Expr. <TMPL_IF EXPR="defined ($test)"> Brian McCain PageMasters Internet Group ----- Original Message ----- From: "Douglas Kirkland" <dlk...@rh...> To: <Htm...@li...> Sent: Friday, June 21, 2002 2:16 PM Subject: Re: [htmltmpl] TMPL_IF truth vs definition | On Friday 21 June 2002 09:43 am, you wrote: | > Hi Tugrul, | > | > I normally don't jump in on these conversations, but are you really | > suggesting that TMPL_IF be true if the value of the variable is 0? 0 = true | > goes against everything computers stand for. | > | > > TMPL_IF works all of the time except when the data that exists just | > > happens to be 0 (or anything else that is false). | > | > So, what you are saying is TMPL_IF is false if the data is false. Sounds | > like it works perfectly to me! | > | The problem I see with that, is if the TMPL_IF is reading the data. we | should be able to see if the data equal a value. If that is a case then | there should be something like this: | | <TMPL_IF NAME="FOO" eq 5> | | The data is aready known because it knowns that the data is either zero or | something else. It should not be that much work to do a test against a value. | | my 2 cents | | Douglas | | | ------------------------------------------------------- | Sponsored by: | ThinkGeek at http://www.ThinkGeek.com/ | _______________________________________________ | Html-template-users mailing list | Htm...@li... | https://lists.sourceforge.net/lists/listinfo/html-template-users | |
From: Phil T. <phi...@bi...> - 2002-06-21 21:55:09
|
SSBhbSBnZXR0aW5nIHRoZSBlcnJvciBiZWxvdywgSSB3b3VsZCBiZSBncmF0ZWZ1bCBpZiBzb21l Ym9keSBjb3VsZCBleHBsYW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LjFdIFByZW1hdHVyZSBlbmQgb2Ygc2NyaXB0IGhlYWRlcnM6IC92YXIvd3d3L2NnaS1i aW4vY29udHJvbC5jZ2kNCg0K |
From: Douglas K. <dlk...@rh...> - 2002-06-21 21:17:34
|
On Friday 21 June 2002 09:43 am, you wrote: > Hi Tugrul, > > I normally don't jump in on these conversations, but are you really > suggesting that TMPL_IF be true if the value of the variable is 0? 0 = true > goes against everything computers stand for. > > > TMPL_IF works all of the time except when the data that exists just > > happens to be 0 (or anything else that is false). > > So, what you are saying is TMPL_IF is false if the data is false. Sounds > like it works perfectly to me! > The problem I see with that, is if the TMPL_IF is reading the data. we should be able to see if the data equal a value. If that is a case then there should be something like this: <TMPL_IF NAME="FOO" eq 5> The data is aready known because it knowns that the data is either zero or something else. It should not be that much work to do a test against a value. my 2 cents Douglas |