html-template-users Mailing List for HTML::Template (Page 104)
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-07-08 08:42:34
|
Glad this thread got picked up again. Quickly going over old ground, here is a real example of a template and resultant html I am producing. <tr onClick=" doReturnValues({ 'account_details': [ '<tmpl_var name="acc_id">', '<tmpl_var name="name_tx">', '<tmpl_var name="company_tx">' ] }); parent.close();" > <td><tmpl_var name="acc_id"> </td> <td><tmpl_var name="name_tx"> </td> <td><tmpl_var name="company"> </td> </tr> <tr onClick=" doReturnValues({ 'account_details': [ '10', 'Mr. A Another's Brother', 'Another Company' ] }); parent.close();" > <td>10 </td> <td>Mr. A Another's brother </td> <td>Another Company </td> </tr> The javascript in the onClick event of the row is broken because of the character sequence - Another's Since a single piece of data is used in several contexts I have to escape in several ways. Which leaves me with a couple of options 1) I create several sets of the same data and pre filter for all the various replacement contexts before handing over to html-tmpl for substitution. 2) I post filter my html searching for js literal strings to escape. Neither of these are very appealing. The one thing I do know is the context of the replacement at tmpl design time. Therefore it would be the perfect place to specify escape filtering. > Mmm, maybe. Or a way to add new escapes at runtime. Sam - I like this. Maybe definitions could be held in a config file that could be overridden at runtime. The file could include the defaults already used (HTML , etc) and new ones could easily be added if the need arose. David Kaufman posted a patch he'd written for v2.4 that did the trick. It includes a few more character sequences that croak as well. Thanks for the help Glenn |
From: Philip S T. <phi...@gm...> - 2002-07-08 07:46:06
|
On Mon, 8 Jul 2002, Andrew Ho wrote: > I think adding a generic escape=quote is a bad idea. That doesn't give any > context, and JavaScript strings quote quotes way differently from (for > example) HTML or SQL strings. Within JavaScript there are multiple quoting well, for HTML quoting, you'd use escape=HTML. SQL, well, I hope you aren't using HTML::Template for SQL, but then again... escape=quote would basically do ' => \' and " => \" - quoting single and double quotes that way, you can use the same tmpl_var in your javascript and also your html without a problem. I agree that the sub may be better, especially for future extensibility |
From: Andrew Ho <an...@te...> - 2002-07-08 07:39:20
|
Hello, PT>Sam, I think this needs an escape=quote parameter. What do you think. PT>Would only be a couple of lines added. I think adding a generic escape=quote is a bad idea. That doesn't give any context, and JavaScript strings quote quotes way differently from (for example) HTML or SQL strings. Within JavaScript there are multiple quoting methods you might want as well. Even if you called it "jsstringquote" to be specific, it's still not clear that it's intended for a string inside single quotes (since JavaScript allows you to use double quotes for strings, too). I like the idea of adding a simple way to add functions to do quoting. Humbly, Andrew ---------------------------------------------------------------------- Andrew Ho http://www.tellme.com/ an...@te... Engineer in...@te... Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELL Fax 650-930-9101 ---------------------------------------------------------------------- |
From: Philip S T. <phi...@gm...> - 2002-07-08 07:20:32
|
On Mon, 8 Jul 2002, Sam Tregar wrote: > escape => { > quote => sub { $$_[0] =~ s/(['"])/\$1/g; } > } > > Or possibly setting $_: > > escape => { > quote => sub { s/(['"])/\$1/g; } > } > > But that might be just a little too cute. Yeah, seems good enough, except you'd have to make that \\$1 |
From: Sam T. <sa...@tr...> - 2002-07-08 07:11:17
|
On Mon, 8 Jul 2002, Philip S Tellis wrote: > how about this: > > new HTML::Template(..., escape={ > name => 'quote', > find => qr/(['"])/, > replace => '\$1' > }) I think I'd prefer: escape => { quote => sub { $$_[0] =~ s/(['"])/\$1/g; } } Or possibly setting $_: escape => { quote => sub { s/(['"])/\$1/g; } } But that might be just a little too cute. -sam |
From: Philip S T. <phi...@gm...> - 2002-07-08 06:12:11
|
On Sun, 7 Jul 2002, Sam Tregar wrote: > > Sam, I think this needs an escape=quote parameter. What do you think. > > Would only be a couple of lines added. > > Mmm, maybe. Or a way to add new escapes at runtime. how about this: new HTML::Template(..., escape={ name => 'quote', find => qr/(['"])/, replace => '\$1' }) |
From: Sam T. <sa...@tr...> - 2002-07-08 05:46:44
|
On Mon, 8 Jul 2002, Philip S Tellis wrote: > Sam, I think this needs an escape=quote parameter. What do you think. > Would only be a couple of lines added. Mmm, maybe. Or a way to add new escapes at runtime. -sam |
From: Philip S T. <phi...@gm...> - 2002-07-08 04:43:08
|
On Sun, 7 Jul 2002, Sam Tregar wrote: > > <button onclick="javascript: js_str='It's a wonderful life'";></button> > > Try <tmpl_var name="tmpl_str" escape=HTML>. " doesn't translate to " inside a javascsript string. Sam, I think this needs an escape=quote parameter. What do you think. Would only be a couple of lines added. Philip |
From: Philip S T. <phi...@gm...> - 2002-07-08 04:41:19
|
On Sun, 7 Jul 2002, Douglas Kirkland wrote: > You need to filter the data looking for the character in the data stream. > This is what I use to take care of that problem. > > $data =~ s|"|\\"|g; This won't work if you use the same var in javascript and in html. |
From: Sam T. <sa...@tr...> - 2002-07-07 17:42:43
|
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> Try <tmpl_var name="tmpl_str" escape=HTML>. -sam |
From: Douglas K. <dlk...@rh...> - 2002-07-07 12:32:23
|
On Thursday 27 June 2002 09:59 pm, Glenn Morgan wrote: > 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? > You need to filter the data looking for the character in the data stream. This is what I use to take care of that problem. $data =~ s|"|\\"|g; -- Douglas Kirkland Technical Support Department Rhyton Corporation te...@rh... http://www.rhyton.com |
From: Andrew J. <an...@li...> - 2002-07-07 09:32:40
|
Zachary Buckholz wrote: > Does anyone have any pointers on the best way to utilize HTML::Template > and a mail merge module? > > I finished my initial project http://www.securitysaint.com using > HTML::Template and CGI::Application but I want to build onto it by > sending weekly status emails to the users giving them stats for their > websites in a nice HTML table. You can see an example of what I am > trying to do here: http://www.securitysaint.com/stats_example.html > > I already wrote the SQL queries I want to run and have pseudo code for > the application but the actual part of sending a HTML message is what I > am focusing on now. > > I would like to be able to build a template just like I do for the > website, then have a perl script read the template, fill in the data and > send it off. > > Has anyone used HTML::Template with a mail merge app? Can you provide > any pointers? > I did this with MIME::Lite a while back. Filling in a text file or HTML page without images was easy, but HTML w/images was a bit tricky. But I now see that MIME::Lite::HTML has been created to handle exactly that. Both of these modules are (of course) available on CPAN. |
From: Philip S T. <phi...@gm...> - 2002-07-07 07:16:24
|
Sometime on Jul 6, Zachary Buckholz assembled some asciibets to say: > Does anyone have any pointers on the best way to utilize > HTML::Template and a mail merge module? Well, I do this to send out birthday wishes to everyone in my department, with Cc's to everyone else: bday.tmpl: From: <dept_address> To: <tmpl_loop birthday_kids><tmpl_var address><tmpl_unless __LAST__>, </tmpl_unless></tmpl_loop> Bcc: <tmpl_loop all_kids><tmpl_var address><tmpl_unless __LAST__>, </tmpl_unless></tmpl_loop> Subject: Happy birthday <tmpl_loop birthday_kids><tmpl_var name><tmpl_unless __LAST__>, </tmpl_unless></tmpl_loop> Body of the message here.... bday.pl: #!/usr/bin/perl -w use strict; use HTML::Template; my $t = new HTML::Template(filename=>'bday.tmpl', loop_context_vars=>1); # set vars here open MAIL, "|/usr/sbin/sendmail -t" or die "$!"; print MAIL $t->output(); close MAIL or warn "$!"; __END__ Don't forget the tabs on the line after To and Bcc or sendmail will think that it's the end of that particular header line. Philip -- Michael: Hi. I'm Michael Jackson, from The Jacksons. Homer: I'm Homer Simpson, from the Simpsons. Stark Raving Dad |
From: Zachary B. <zbu...@ho...> - 2002-07-07 04:21:57
|
Does anyone have any pointers on the best way to utilize HTML::Template = and a mail merge module? I finished my initial project http://www.securitysaint.com using = HTML::Template and CGI::Application but I want to build onto it by = sending weekly status emails to the users giving them stats for their = websites in a nice HTML table. You can see an example of what I am = trying to do here: http://www.securitysaint.com/stats_example.html I already wrote the SQL queries I want to run and have pseudo code for = the application but the actual part of sending a HTML message is what I = am focusing on now. I would like to be able to build a template just like I do for the = website, then have a perl script read the template, fill in the data and = send it off.=20 Has anyone used HTML::Template with a mail merge app? Can you provide = any pointers? Thanks zack |
From: David W. <da...@wh...> - 2002-07-06 22:08:31
|
On 7/6/02 11:06 AM, "Sam Tregar" <sa...@tr...> claimed: > This sort of thing is generally done with Javascript. Since javascript > runs in the client's web browser it's in an ideal place to figure out > the client's platform. Buy a good book on Javascript or visit one of the > many free Javascript resources on the web for details. For a JavaScript solution, see "The Ultimate JavaScript Client Sniffer" http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html For Perl, see HTTP::BrowserDetect: http://search.cpan.org/search?dist=HTTP-BrowserDetect HTH, David -- David Wheeler AIM: dwTheory da...@wh... ICQ: 15726394 http://david.wheeler.net/ Yahoo!: dew7e Jabber: Th...@ja... |
From: Sam T. <sa...@tr...> - 2002-07-06 20:07:39
|
On Sat, 6 Jul 2002, Will wrote: > Does anyone know if there is a way to use Perl in > conjunction with HTML::Template to determine a user's > screen size/browser type/OS, and then (probably by > using a selection structure) redirect the user to an > appropriate web design suited to the users browser > specifications? This sort of thing is generally done with Javascript. Since javascript runs in the client's web browser it's in an ideal place to figure out the client's platform. Buy a good book on Javascript or visit one of the many free Javascript resources on the web for details. -sam |
From: Philip S T. <phi...@gm...> - 2002-07-06 19:38:33
|
Sometime on Jul 6, Will assembled some asciibets to say: > Does anyone know if there is a way to use Perl in conjunction with > HTML::Template to determine a user's screen size/browser type/OS, > and then (probably by using a selection structure) redirect the user > to an appropriate web design suited to the users browser > specifications? No. There is no way to figure out anything other than the browser name and version (and even then it could be faked). These things need to be done client-side, with javascript or something else. -- I thought there was something fishy about the butler. Probably a Pisces, working for scale. -- Firesign Theatre, "The Further Adventures of Nick Danger" |
From: Will <sel...@ya...> - 2002-07-06 19:01:30
|
Greets Folks, This question may be a bit loaded (cause I would bet the answer would be "yes"), but I'll ask it anyway in hopes of getting a "this is how it is done" answer. Here's goes. Does anyone know if there is a way to use Perl in conjunction with HTML::Template to determine a user's screen size/browser type/OS, and then (probably by using a selection structure) redirect the user to an appropriate web design suited to the users browser specifications? It seems it would be really useful if you think about the possibilities here. So many people have varying platforms and configurations, like "Yes Flash, No Flash", "600x800 or 768x1024", NS or IE" (and what versions), Javascript On/Javascript Off", Mac_OS/Windows(v?), CSS or not?, JAVA Applets enabled or not, etc, etc., etc. Just askin'... =) Will __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com |
From: Sam T. <sa...@tr...> - 2002-07-06 18:42:03
|
On Sat, 6 Jul 2002, Phil Taylor wrote: > Is this the intended behaviour of the loop processing? Yes. > I would have thought it should loop through the array pulling out only > those hash elements which are defined in the template. Set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mF5IHB1bGxpbmcgb3V0IG9ubHkgdGhvc2UgaGFzaCBlbGVtZW50cyB3aGljaCBhcmUgIGRl ZmluZWQgaW4gdGhlIHRlbXBsYXRlLg0KDQpBbnkgdGhvdWdodHMgYXBwcmVjaWF0ZWQNCg0KUGhp bA0K |
From: Sam T. <sa...@tr...> - 2002-07-04 06:08:50
|
Hello all. As previously announced, the HTML::Template mailing-list at VM.com is being shut down. A new mailing-list at SourceForge.net has been setup and all subscribers to old list as of two weeks ago are subscribed to the new list. If you joined us recently please go sign up at: http://lists.sourceforge.net/lists/listinfo/html-template-users I will shut off the VM.com list sometime this weekend. I will also be releasing new versions of the HTML::Template modules with the new mailing-list address (among other things!) and updating the website. -sam |
From: Sam T. <sa...@tr...> - 2002-07-03 16:38:21
|
On Wed, 3 Jul 2002, Kapoor, Nishikant X wrote: > Here is the test case. Not sure if I am missing something. Would > appreciate some feedback. > > I am using H::T version 2.5 This will work in HTML::Template 2.6. Currently HTML_TEMPLATE_ROOT and path don't work together. -sam |
From: Kapoor, N. X <Nis...@xc...> - 2002-07-03 16:19:22
|
Here is the test case. Not sure if I am missing something. Would = appreciate some feedback. I am using H::T version 2.5 Thanks Nishi ----------------- ~/htdocs/wpaa/cgi-bin/testInc.pl --------------------- #!/usr/bin/perl -w=20 use HTML::Template; my $tmpl =3D HTML::Template->new(filename =3D> 'main.tmpl', path =3D> 'wpaa/test'); print "Content-Type: text/html\n\n"; print $tmpl->output; ------------------- Error -------------------------- [~/htdocs/wpaa/cgi-bin] $ perl testInc.pl HTML::Template->new() : Cannot open included file main.tmpl : file not = found. at HTML/Template.pm line 1524 = HTML::Template::_init_template('HTML::Template=3DHASH(0x2006aa98)') = called at HTML/Template.pm line 1129 HTML::Template::_init('HTML::Template=3DHASH(0x2006aa98)') = called at HTML/Template.pm line 1023 HTML::Template::new('HTML::Template', 'filename', 'main.tmpl', = 'path', 'wpaa/test') called at testInc.pl line 3 --------------- HTML_TEMPLATE_ROOT is set -------------------- [~/htdocs/wpaa/cgi-bin] $ env | grep HTML HTML_TEMPLATE_ROOT=3D/vhe/nim1/users/nkapoor/htdocs -------------------- main.tmpl exists --------------------- [~/htdocs/wpaa/cgi-bin] ls $HTML_TEMPLATE_ROOT/wpaa/test/main.tmpl /vhe/nim1/users/nkapoor/htdocs/wpaa/test/main.tmpl |
From: John B. <joh...@ya...> - 2002-07-03 12:01:50
|
To stir the pot a bit: If you're going to put the template in the same file as your code, you might as well forget HTML::Template altogether and just print out your page with a "print <<HERE;" statement and embedded variables. It amounts to the same concept: first you prepare your substitution data, then you print the page making the substitutions. And the print version is more versatile, although less maintainable. - John --- Philip S Tellis <phi...@gm...> wrote: > On Tue, 2 Jul 2002, Kenny Smith wrote: > > > > my $t = new HTML::Template(filehandle => *DATA); > > > > > > then, you just put your template in the source > file itself, either after > > > __DATA__ or after __END__ > > > > But... that goes against everything that > HTML::Template stands for, > > imo. The separation of program from display.. the > ability to change > > the look without editing the source, etc. > > true, but there is that small percent of web site > hosting companies that > don't let you keep files outside your document root > - and you really > don't want your templates read by everyone. > > besides, what you can really do, is get your > templates designed > separately, and then just copy then into the bottom > of your file before > deployment. > > like I said though, I've never done that. > > Philip ===== "Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do." - They Might Be Giants, http://www.tmbg.com __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com |
From: Philip S T. <phi...@gm...> - 2002-07-03 07:35:49
|
On Tue, 2 Jul 2002, Kenny Smith wrote: > > my $t = new HTML::Template(filehandle => *DATA); > > > > then, you just put your template in the source file itself, either after > > __DATA__ or after __END__ > > But... that goes against everything that HTML::Template stands for, > imo. The separation of program from display.. the ability to change > the look without editing the source, etc. true, but there is that small percent of web site hosting companies that don't let you keep files outside your document root - and you really don't want your templates read by everyone. besides, what you can really do, is get your templates designed separately, and then just copy then into the bottom of your file before deployment. like I said though, I've never done that. Philip |