html-template-users Mailing List for HTML::Template (Page 53)
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: Karen J. C. <si...@ph...> - 2004-05-03 23:00:21
|
On Mon, 3 May 2004, Mark Fuller wrote: MF>It seems to me the latter would be more efficient? If I am already testing MF>my criteria for selected, then I don't have to do an "if" again in the HTML. MF>In other words, is it more efficient to resolve the variable contents, or to MF>test variable? The main thing the TMPL_IF offers is the choice for the template writer to change the format. If you hardcode it to "SELECTED" you're requiring a selection box, vs. radio buttons (which use "CHECKED"). (Well, technically if you leave the non-selected ones blank you *could* still use it in a TMPL_IF, but that's a bit risky...) -- Karen J. Cravens si...@ph... |
From: Mathew R. <mat...@re...> - 2004-05-03 22:55:15
|
The difference would be not be measurable unless you did a 1,000,000 = instantations, then timed the results, since both Perl and H::T are = reasonably quick a text processing. Mathew ----- Original Message -----=20 From: "Mark Fuller" <mar...@ea...> To: <ja...@jo...> Cc: <htm...@li...> Sent: Tuesday, May 04, 2004 8:43 AM Subject: Re: [htmltmpl] Select/option How to set "selected"? > Jason, thanks. The way you do the push helped me. I was putting the = values > into a temporary hash and then assigning the hash as a reference. I = wanted > to do it more directly like you did, but didn't know the semantics. >=20 > Regarding this: >=20 > > $selected =3D 1 if i_want_this_option_selected( $option ); > and > > <TMPL_LOOP NAME=3DOCCUPATION_LOOP> > > <option value=3D"<TMPL_VAR NAME=3DVAL>" <TMPL_IF > > NAME=3D"SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=3DTEXT></option> > > </TMPL_LOOP> >=20 > Do you think this is more efficient, or is it more efficient to do as = Puneet > suggested: >=20 > > $selected =3D ' selected' if i_want_this_option_selected( $option = ); > and > > <TMPL_LOOP NAME=3DOCCUPATION_LOOP> > > <option value=3D"<TMPL_VAR NAME=3DVAL>"<TMPL_VAR = NAME=3DSELECTED>><TMPL_VAR > NAME=3DTEXT></option> > > </TMPL_LOOP> >=20 > It seems to me the latter would be more efficient? If I am already = testing > my criteria for selected, then I don't have to do an "if" again in the = HTML. > In other words, is it more efficient to resolve the variable contents, = or to > test variable? >=20 > Mark >=20 > ----- Original Message -----=20 > From: "Jason Purdy" <ja...@jo...> > To: "Mark Fuller" <mar...@ea...> > Cc: <htm...@li...> > Sent: Monday, May 03, 2004 2:36 PM > Subject: Re: [htmltmpl] Select/option How to set "selected"? >=20 >=20 > > Hi Mark, > > > > How are you determining which option to pre-select? It might be = better > > to use HTML::FillInForm. > > > > Other than that, here's what you would do if you want to re-invent = the > > wheel: > > > > ### In your programming code ### > > my $template =3D HTML::Template->new( 'filename' =3D> 'file.TMPL' ); > > my $occloop_ar =3D []; # occupation loop array ref. > > while ( my ( $option, $value ) =3D $sth->fetchrow_array ) { > > my $selected =3D 0; > > $selected =3D 1 if i_want_this_option_selected( $option ); > > push @$array_ref, { > > 'VAL' =3D> $option, > > 'TEXT' =3D> $value, > > 'SELECTED' =3D> $selected, > > }; > > } > > $template->param( 'OCCUPATION_LOOP' =3D> $occloop_ar ); > > > > ### Then in your template code ### > > Occupation: <select name=3D"occupation"> > > <TMPL_LOOP NAME=3DOCCUPATION_LOOP> > > <option value=3D"<TMPL_VAR NAME=3DVAL>" <TMPL_IF > > NAME=3D"SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=3DTEXT></option> > > </TMPL_LOOP> > > > > Cheers, > > > > Jason > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: Oracle 10g > > Get certified on the hottest thing ever to hit the market... Oracle = 10g. > > Take an Oracle 10g class now, and we'll give you the exam FREE. > > http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle = 10g.=20 > Take an Oracle 10g class now, and we'll give you the exam FREE.=20 > http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |
From: Puneet K. <pk...@ei...> - 2004-05-03 22:54:14
|
Mark Fuller wrote: > Jason, thanks. The way you do the push helped me. I was putting the values > into a temporary hash and then assigning the hash as a reference. I wanted > to do it more directly like you did, but didn't know the semantics. > > Regarding this: > > >> $selected = 1 if i_want_this_option_selected( $option ); > > and > >><TMPL_LOOP NAME=OCCUPATION_LOOP> >><option value="<TMPL_VAR NAME=VAL>" <TMPL_IF >>NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option> >></TMPL_LOOP> > > > Do you think this is more efficient, or is it more efficient to do as Puneet > suggested: definitely as Puneet suggested ;-). Seriously, unless you are dealing with gazillions of moolabytes of data being hit every second by the entire population of Wyoming, don't sweat. That said, my philosophy is to dump as much work on the database as possible. Why? -- because db programs have been developed over years and years (not that Perl has not been, but your or my code may not have the same advantage), db servers are typically fast machines, db software have been honed to do set processing, evaluations, calculations, etc. There is a lot of science behind db theory. Definitely use it to your advantage. Of course, not everything is amenable to a SQL statement. That is where Perl can shine. > > >> $selected = ' selected' if i_want_this_option_selected( $option ); > > and > >><TMPL_LOOP NAME=OCCUPATION_LOOP> >><option value="<TMPL_VAR NAME=VAL>"<TMPL_VAR NAME=SELECTED>><TMPL_VAR > > NAME=TEXT></option> > >></TMPL_LOOP> > > > It seems to me the latter would be more efficient? If I am already testing > my criteria for selected, then I don't have to do an "if" again in the HTML. > In other words, is it more efficient to resolve the variable contents, or to > test variable? > > Mark > > ----- Original Message ----- > From: "Jason Purdy" <ja...@jo...> > To: "Mark Fuller" <mar...@ea...> > Cc: <htm...@li...> > Sent: Monday, May 03, 2004 2:36 PM > Subject: Re: [htmltmpl] Select/option How to set "selected"? > > > >>Hi Mark, >> >>How are you determining which option to pre-select? It might be better >>to use HTML::FillInForm. >> >>Other than that, here's what you would do if you want to re-invent the >>wheel: >> >>### In your programming code ### >>my $template = HTML::Template->new( 'filename' => 'file.TMPL' ); >>my $occloop_ar = []; # occupation loop array ref. >>while ( my ( $option, $value ) = $sth->fetchrow_array ) { >> my $selected = 0; >> $selected = 1 if i_want_this_option_selected( $option ); >> push @$array_ref, { >> 'VAL' => $option, >> 'TEXT' => $value, >> 'SELECTED' => $selected, >> }; >>} >>$template->param( 'OCCUPATION_LOOP' => $occloop_ar ); >> >>### Then in your template code ### >>Occupation: <select name="occupation"> >><TMPL_LOOP NAME=OCCUPATION_LOOP> >><option value="<TMPL_VAR NAME=VAL>" <TMPL_IF >>NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option> >></TMPL_LOOP> >> >>Cheers, >> >>Jason >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: Oracle 10g >>Get certified on the hottest thing ever to hit the market... Oracle 10g. >>Take an Oracle 10g class now, and we'll give you the exam FREE. >>http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >>_______________________________________________ >>Html-template-users mailing list >>Htm...@li... >>https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Mark F. <mar...@ea...> - 2004-05-03 22:44:28
|
Jason, thanks. The way you do the push helped me. I was putting the values into a temporary hash and then assigning the hash as a reference. I wanted to do it more directly like you did, but didn't know the semantics. Regarding this: > $selected = 1 if i_want_this_option_selected( $option ); and > <TMPL_LOOP NAME=OCCUPATION_LOOP> > <option value="<TMPL_VAR NAME=VAL>" <TMPL_IF > NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option> > </TMPL_LOOP> Do you think this is more efficient, or is it more efficient to do as Puneet suggested: > $selected = ' selected' if i_want_this_option_selected( $option ); and > <TMPL_LOOP NAME=OCCUPATION_LOOP> > <option value="<TMPL_VAR NAME=VAL>"<TMPL_VAR NAME=SELECTED>><TMPL_VAR NAME=TEXT></option> > </TMPL_LOOP> It seems to me the latter would be more efficient? If I am already testing my criteria for selected, then I don't have to do an "if" again in the HTML. In other words, is it more efficient to resolve the variable contents, or to test variable? Mark ----- Original Message ----- From: "Jason Purdy" <ja...@jo...> To: "Mark Fuller" <mar...@ea...> Cc: <htm...@li...> Sent: Monday, May 03, 2004 2:36 PM Subject: Re: [htmltmpl] Select/option How to set "selected"? > Hi Mark, > > How are you determining which option to pre-select? It might be better > to use HTML::FillInForm. > > Other than that, here's what you would do if you want to re-invent the > wheel: > > ### In your programming code ### > my $template = HTML::Template->new( 'filename' => 'file.TMPL' ); > my $occloop_ar = []; # occupation loop array ref. > while ( my ( $option, $value ) = $sth->fetchrow_array ) { > my $selected = 0; > $selected = 1 if i_want_this_option_selected( $option ); > push @$array_ref, { > 'VAL' => $option, > 'TEXT' => $value, > 'SELECTED' => $selected, > }; > } > $template->param( 'OCCUPATION_LOOP' => $occloop_ar ); > > ### Then in your template code ### > Occupation: <select name="occupation"> > <TMPL_LOOP NAME=OCCUPATION_LOOP> > <option value="<TMPL_VAR NAME=VAL>" <TMPL_IF > NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option> > </TMPL_LOOP> > > Cheers, > > Jason > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Jason P. <ja...@jo...> - 2004-05-03 21:37:01
|
Hi Mark, How are you determining which option to pre-select? It might be better to use HTML::FillInForm. Other than that, here's what you would do if you want to re-invent the wheel: ### In your programming code ### my $template = HTML::Template->new( 'filename' => 'file.TMPL' ); my $occloop_ar = []; # occupation loop array ref. while ( my ( $option, $value ) = $sth->fetchrow_array ) { my $selected = 0; $selected = 1 if i_want_this_option_selected( $option ); push @$array_ref, { 'VAL' => $option, 'TEXT' => $value, 'SELECTED' => $selected, }; } $template->param( 'OCCUPATION_LOOP' => $occloop_ar ); ### Then in your template code ### Occupation: <select name="occupation"> <TMPL_LOOP NAME=OCCUPATION_LOOP> <option value="<TMPL_VAR NAME=VAL>" <TMPL_IF NAME="SELECTED">SELECTED</TMPL_IF>><TMPL_VAR NAME=TEXT></option> </TMPL_LOOP> Cheers, Jason |
From: Zheng (G. F. <zf...@ha...> - 2004-05-03 21:16:26
|
Try this: <TMPL_LOOP NAME=3DOCCUPATION_LOOP>=20 <option value=3D"<TMPL_VAR NAME=3DVAL>" <TMPL_VAR NAME=3D"SELECTED">><T= MPL_VAR NAME=3DTEXT></option>=20 </TMPL_LOOP> where the value of SELECTED is either 0 or 1 dependends o= n whether that item is selected=2E This should work for multiple select= options too=2E Zheng=20 --Original Message-- From: Mark Fuller<mark=2Efuller@earthlink=2Enet> T= o: <html-template-users@lists=2Esourceforge=2Enet>=20 Subject: [htmltmpl] Select/option How to set "selected"?=20 I am creating a select list where all the "option" content comes from= a=20 mySQL table=2E The following works fine:=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 Occupation: <select name=3D"occupation">=20 <TMPL_LOOP NAME=3DOCCUPATION_LOOP>=20 <option value=3D"<TMPL_VAR NAME=3DVAL>"><TMPL_VAR NAME=3DTEXT></option>= =20 </TMPL_LOOP>=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 How can I specify a row should be "selected"? The TMPL_VAR named "VAL" = is a=20 numeric index=2E If I could use TMPL_IF and concatenate the value of "V= AL", I=20 think it would work=2E=20 <TMPL_IF NAME=3D"SEL"<TMPL_VAR NAME=3D"VAL">>=20 selected=20 </TMPL_IF>=20 In my program I could set "$sel5 =3D 1"=2E=20 Is there any way to do this?=20 Thanks,=20 Mark=20 -------------------------------------------------------=20 This SF=2ENet email is sponsored by: Oracle 10g=20 Get certified on the hottest thing ever to hit the market=2E=2E=2E Orac= le 10g=2E=20 Take an Oracle 10g class now, and we'll give you the exam FREE=2E=20 http://ads=2Eosdn=2Ecom/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick=20 _______________________________________________=20 Html-template-users mailing list=20 Html-template- users@lists=2Esourceforge=2Enet=20 https://lists=2Esourceforge=2Enet/lists/listinfo/html-template-users=20 |
From: Mark F. <mar...@ea...> - 2004-05-03 21:16:25
|
Thanks. That will work perfectly. Mark ----- Original Message ----- From: "Puneet Kishor" <pk...@ei...> To: "Mark Fuller" <mar...@ea...> Cc: <htm...@li...> Sent: Monday, May 03, 2004 2:13 PM Subject: Re: [htmltmpl] Select/option How to set "selected"? > Mark Fuller wrote: > > I am creating a select list where all the "option" content comes from a > > mySQL table. The following works fine: > > > > ==================== > > Occupation: <select name="occupation"> > > <TMPL_LOOP NAME=OCCUPATION_LOOP> > > <option value="<TMPL_VAR NAME=VAL>"><TMPL_VAR NAME=TEXT></option> > > </TMPL_LOOP> > > ==================== > > > > How can I specify a row should be "selected"? The TMPL_VAR named "VAL" is a > > numeric index. If I could use TMPL_IF and concatenate the value of "VAL", I > > think it would work. > > > > <TMPL_IF NAME="SEL"<TMPL_VAR NAME="VAL">> > > selected > > </TMPL_IF> > > > > In my program I could set "$sel5 = 1". > > > > Is there any way to do this? > > > > > there are several ways to do this. I prefer simply constructing my sql > in such a way that the selected value is identified > > SELECT val, > text, > (if then else to return 'selected' or '') AS selected > FROM table > WHERE whatever... > > then in my template... > > <tmpl_loop occupations> > <option value="<tmpl_var val>" <tmpl_var selected>> > <tmpl_var text> > </option> > </tmpl_loop> |
From: Puneet K. <pk...@ei...> - 2004-05-03 21:13:47
|
Mark Fuller wrote: > I am creating a select list where all the "option" content comes from a > mySQL table. The following works fine: > > ==================== > Occupation: <select name="occupation"> > <TMPL_LOOP NAME=OCCUPATION_LOOP> > <option value="<TMPL_VAR NAME=VAL>"><TMPL_VAR NAME=TEXT></option> > </TMPL_LOOP> > ==================== > > How can I specify a row should be "selected"? The TMPL_VAR named "VAL" is a > numeric index. If I could use TMPL_IF and concatenate the value of "VAL", I > think it would work. > > <TMPL_IF NAME="SEL"<TMPL_VAR NAME="VAL">> > selected > </TMPL_IF> > > In my program I could set "$sel5 = 1". > > Is there any way to do this? > there are several ways to do this. I prefer simply constructing my sql in such a way that the selected value is identified SELECT val, text, (if then else to return 'selected' or '') AS selected FROM table WHERE whatever... then in my template... <tmpl_loop occupations> <option value="<tmpl_var val>" <tmpl_var selected>> <tmpl_var text> </option> </tmpl_loop> |
From: Mark F. <mar...@ea...> - 2004-05-03 20:57:23
|
I am creating a select list where all the "option" content comes from a mySQL table. The following works fine: ==================== Occupation: <select name="occupation"> <TMPL_LOOP NAME=OCCUPATION_LOOP> <option value="<TMPL_VAR NAME=VAL>"><TMPL_VAR NAME=TEXT></option> </TMPL_LOOP> ==================== How can I specify a row should be "selected"? The TMPL_VAR named "VAL" is a numeric index. If I could use TMPL_IF and concatenate the value of "VAL", I think it would work. <TMPL_IF NAME="SEL"<TMPL_VAR NAME="VAL">> selected </TMPL_IF> In my program I could set "$sel5 = 1". Is there any way to do this? Thanks, Mark |
From: Sam T. <sa...@tr...> - 2004-04-30 19:04:08
|
Krang v1.017 is now available. Notable changes in this release: - A major performance speedup for previewing and publishing is now in place. Links to stories and media which are unchanged since their last publish will no longer trigger publishing. - The category chooser now respects permissions settings. - More bugs are fixed. Detailed change-log here: http://krang.sf.net/docs/changelog.html Krang is an Open Source web-publisher / content-management system designed for large-scale magazine-style websites. It is a 100% Perl application using Apache/mod_perl and MySQL, as well as numerous CPAN modules. Krang provides a powerful and easy to use story and media editing environment for magazine editors, as well as a complete template development environment for web designers. On the back-end, Perl programmers can customize Krang to control the data entered in the story editor and add code to drive the templates to build output. Krang can be enhanced with add-ons containing new skins and other new features. Krang easily handles large data sets and can manage multiple websites in a single installation. For more information about Krang, visit the Krang website: http://krang.sourceforge.net/ There you can download Krang, view screenshots, read documentation, join our mailing-lists and access the CVS tree. - the Krang team |
From: Sam T. <sa...@tr...> - 2004-04-25 18:02:05
|
On Sun, 25 Apr 2004, Steven Bauer wrote: > I apolgize for bothering you about this, but I must be looking in > the wrong place. I looked through the documentation on release notes > for all the HTML::Template projects on the sourceforge project page > , the documents on the HTML::Template home page > (html-template.sourceforge.net), my local cpan build directory for > HTML::Template::JIT and what ever I could find on HTML::Template on > CPAN. The only HTML::Template::JIT documentation I found was the > home page documentation, and I did not mention HTML::Template::Expr. > Am I overlooking something? Let me apologize. I thought I'd included a note about my desire to support HTML::Template::Expr in HTML::Template::JIT in a future version. It looks like I didn't. So what I should have said when you first asked is simply "no, they don't work together now but that might change in a future version." -sam |
From: Sam T. <sa...@tr...> - 2004-04-24 07:21:26
|
On Fri, 23 Apr 2004, Steven Bauer wrote: > Is it possible to instantiate a template that uses both H::T:Expr > and H::T:JIT at the same time? Try reading the docs for HTML::Template::JIT. It mentions the status of HTML::Template::Expr support. -sam |
From: Steven B. <bau...@ya...> - 2004-04-23 16:12:31
|
Is it possible to instantiate a template that uses both H::T:Expr and H::T:JIT at the same time? Could it be as simple as passing the jit parameter to H::T:Expr->new()? Thank You for your help. |
From: Sam T. <sa...@tr...> - 2004-04-20 17:06:04
|
Krang v1.016 in now available. Changes in this release: - Added support for FreeBSD 4.9 and Debian Linux. - Fixed bugs. Detailed change-log here: http://krang.sf.net/docs/changelog.html Krang is an Open Source web-publisher / content-management system designed for large-scale magazine-style websites. It is a 100% Perl application using Apache/mod_perl and MySQL, as well as numerous CPAN modules. Krang provides a powerful and easy to use story and media editing environment for magazine editors, as well as a complete template development environment for web designers. On the back-end, Perl programmers can customize Krang to control the data entered in the story editor and add code to drive the templates to build output. Krang can be enhanced with add-ons containing new skins and other new features. Krang easily handles large data sets and can manage multiple websites in a single installation. For more information about Krang, visit the Krang website: http://krang.sourceforge.net/ There you can download Krang, view screenshots, read documentation, join our mailing-lists and access the CVS tree. - the Krang team |
From: Clifton R. <cli...@ti...> - 2004-04-18 20:33:37
|
On Sat, Apr 17, 2004 at 02:01:33PM -0500, Puneet Kishor wrote: ... > That is really cool. Could you (here, or offline) share more about how > you did this? In effect, the users are not going to > index.cgi?do=somecrap, but they are going to /website/somecrap. So you Exactly. > can use path_info, but how are you getting the cgi to fire up? > I know this can be accomplished somewhat with the help of mod_rewrite, > but that is not always possible. I am very interested in knowing how > you are accomplishing this. This is really a webserver configuration issue, but just I wanted to reaffirm that it's very possible under Apache or most other webservers. For our application I'm running mini_httpd, which is not super high performance, but seems to be the smallest and simplest webserver that will do SSL. For this webserver, the CGI mapping is simply a list of shell glob patterns that you set in the configuration file. For Apache, the configuration is done via the ScriptAlias directive. The standard convention is to map "/cgi-bin/" in the URL's path, like this: ScriptAlias /cgi-bin/ "/usr/local/apache/share/cgi-bin/" But you can just as easily map some other path, for instance: ScriptAlias /gui/ "/usr/local/mycoolguiscripts/" or (I think) ScriptAlias /gui/ "/usr/local/cgi-bin/thisdoesitall.pl" If you want to have one script for everything, you can, as you noted, take its invocation info out of PATH_INFO with something like this near the head of your script: my $name = $ENV{PATH_INFO}; $name =~ s%^.*/gui[^/]*/%%; # Add trailing index.html if filled in by web server $name =~ s%/$%/index.html%; # Remove leading slash $name =~ s%^/%%; Then access to "http://www.example.com/gui/home.html" would result in $name being set to "home.html", ready for concatenation of your template path prefix. If you have a number of different scripts for different elements of the user interface, one strategy is to hard- or soft- link those scripts into all the appropriate points in the URL hierachy where ScriptAlias points, and then you can simply use SCRIPT_NAME as the starting point instead of PATH_INFO. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |
From: David H. <da...@ho...> - 2004-04-17 21:43:35
|
On 17 Apr 2004, at 21:56, Sam Tregar wrote: > On Sat, 17 Apr 2004, David Hodgkinson wrote: > >> The compilation of the code is what's killing you. > > Don't be so sure. All it takes is one missed index in a critical > table and all the Perl caching in the world won't save you! Heh, OK, I was presuming the ability to run some kind of process monitor and making the first cut ;-) Let's insert the caveats "assuming a sensible database..." and also a "...then given a non-compute intensive perl layer..." My best speedup on a gig was 1000x. 10x from adding an index, 10x from mod_perling and 10x from making one machine into 5 dual process boxes. PS: I'm usually a Template Toolkit user, but my current work was originally H::T and CGI::Application oriented. I've thrown HTML::FillInForm and it's rather sweet. H::T does just enough in just the right way. -- Dave Hodgkinson CTO, Rockit Factory Ltd. http://www.rockitfactory.com/ Web sites for rock bands |
From: Sam T. <sa...@tr...> - 2004-04-17 20:58:43
|
On Sat, 17 Apr 2004, David Hodgkinson wrote: > The compilation of the code is what's killing you. Don't be so sure. All it takes is one missed index in a critical table and all the Perl caching in the world won't save you! -sam |
From: David H. <da...@ho...> - 2004-04-17 20:12:56
|
On 17 Apr 2004, at 21:04, Puneet Kishor wrote: > Oh, I don't think H-T is necessarily the one taking time (wasn't my > intent to seem to blame H-T). I think it is just the way it is with > all the other modules, and the script being cgi and all. > > I figured that with all the modules I am loading, and my own script, > that is probably well over 10k, maybe even 20k lines of code being > chewed through every user click. Which is why I tried CGI-Simple, > because CGI is really, really heavy. > > Since I can't use mod_perl (though, as Cees suggested, FastCGI might, > might be an option -- SpeedyCGI is not; it doesn't run on Windows), > seems like the only thing I could possibly cache was H-T. Hence the > question about IPC-SharedCache. The compilation of the code is what's killing you. There *is* some kind of perl persistence module for IIS, or of course you *could* run apache/mod_perl on win32. -- Dave Hodgkinson CTO, Rockit Factory Ltd. http://www.rockitfactory.com/ Web sites for rock bands |
From: Puneet K. <pk...@ei...> - 2004-04-17 20:04:46
|
On Apr 17, 2004, at 2:53 PM, Sam Tregar wrote: > On Sat, 17 Apr 2004, Puneet Kishor wrote: > >> Mod_perl is out because the server might be running IIS (and even if >> it >> isn't, I am sure my script will have to be re-hacked). >> >> I was hoping for IPC-SharedCache, but that doesn't seem possible on >> Win. > > Have you tried the file_cache option? All it needs is Storable, so it > should work on Windows. On Linux it's as fast as the shared_cache, > although I don't know much about how fast the Windows file-system is. Thanks for the advice. I will try it. > >> Other than simply increasing the hardware capability, are there any >> insights on what I can do? > > Figure out what's actually taking the most time. You can do that by > using a profiler like Devel::DProf. Since you're using DBI you can > also use DBI's built-in profiler to examine the performance of your > database queries. > > Most likely HTML::Template isn't take a significant amount of time in > your application. Usually network delays and database calls take much > longer than HTML::Template. > > Oh, I don't think H-T is necessarily the one taking time (wasn't my intent to seem to blame H-T). I think it is just the way it is with all the other modules, and the script being cgi and all. I figured that with all the modules I am loading, and my own script, that is probably well over 10k, maybe even 20k lines of code being chewed through every user click. Which is why I tried CGI-Simple, because CGI is really, really heavy. Since I can't use mod_perl (though, as Cees suggested, FastCGI might, might be an option -- SpeedyCGI is not; it doesn't run on Windows), seems like the only thing I could possibly cache was H-T. Hence the question about IPC-SharedCache. I'll try shared_cache and try to measure the difference. Thanks. |
From: Sam T. <sa...@tr...> - 2004-04-17 19:55:04
|
On Sat, 17 Apr 2004, Puneet Kishor wrote: > Mod_perl is out because the server might be running IIS (and even if it > isn't, I am sure my script will have to be re-hacked). > > I was hoping for IPC-SharedCache, but that doesn't seem possible on Win. Have you tried the file_cache option? All it needs is Storable, so it should work on Windows. On Linux it's as fast as the shared_cache, although I don't know much about how fast the Windows file-system is. > Other than simply increasing the hardware capability, are there any > insights on what I can do? Figure out what's actually taking the most time. You can do that by using a profiler like Devel::DProf. Since you're using DBI you can also use DBI's built-in profiler to examine the performance of your database queries. Most likely HTML::Template isn't take a significant amount of time in your application. Usually network delays and database calls take much longer than HTML::Template. -sam |
From: Cees H. <ce...@si...> - 2004-04-17 19:44:09
|
Puneet Kishor wrote: > I want to experience the dizzying effect of speed on Windoze. > > Mod_perl is out because the server might be running IIS (and even if it > isn't, I am sure my script will have to be re-hacked). > > I was hoping for IPC-SharedCache, but that doesn't seem possible on Win. > > I tried CGI-Simple for some modest speed increase, but that croaked > because I am also using CGI-Session and I couldn't figure out how to > make CGI-Session work with CGI-Simple. > > Other than simply increasing the hardware capability, are there any > insights on what I can do? > > My app is a single cgi script and uses DBI, Storable, CGI, CGI-Session, > and, of course, H-T. Have a look at FastCGI which should be supported in IIS. Also checkout SpeedyCGI (also known as Persistent Perl), although I don't know if it works on Windows, as I don't use windows myself. Those two options will keep the perl interpreter in memory, so that you save the startup times on your CGI script. Also, if coded right, you can keep a persistent database connection using this as well. If that doesn't help, then you need to profile your code to see where the bottlenecks are. Chances are your database access will be the biggest bottleneck, but that is a generalization and depends completely on your code. See Devel::DProf for info on how to profile your code. Cheers, Cees |
From: <al...@lo...> - 2004-04-17 19:31:34
|
Hello Puneet. Slightly off topic but useful for making templating easy and not looking = like a cgi. Puneet said: >In effect, the users are not going to index.cgi?do=3Dsomecrap, but they = are=20 >going to /website/somecrap. So you can use path_info, but how are you=20 >getting the cgi to fire up? Its easy if you have control over your server. make a soft link to your cgi directory and call it something related to = your app /cgi-bin/information.cgi?do=3Dparameters becomes /mortgage/information/parameters This doesn't work for all servers. I have a shared one that won't let me do that, so I had to have an = extension. but you can do this differently by making up a new filename extension = and making it act like a cgi In this case, Mortgage_Rate.html is a parameter, not a file, but it = looks like a file. http://marketside.com/mortgage/mortgage.cgi/Mortgage_Rate.html On another server that I control, I can change mortgage.cgi to just = mortgage. On this one I could have made the extension .info act like a cgi and = then I could have used http://marketside.com/mortgage/mortgage.info/Mortgage_Rate.html - but by the time I realised that, it was in all the search engines. And this makes it easy to use Templates but not make it too obvious. Alan. |
From: Puneet K. <pk...@ei...> - 2004-04-17 19:10:17
|
I want to experience the dizzying effect of speed on Windoze. Mod_perl is out because the server might be running IIS (and even if it isn't, I am sure my script will have to be re-hacked). I was hoping for IPC-SharedCache, but that doesn't seem possible on Win. I tried CGI-Simple for some modest speed increase, but that croaked because I am also using CGI-Session and I couldn't figure out how to make CGI-Session work with CGI-Simple. Other than simply increasing the hardware capability, are there any insights on what I can do? My app is a single cgi script and uses DBI, Storable, CGI, CGI-Session, and, of course, H-T. Thanks. |
From: Puneet K. <pk...@ei...> - 2004-04-17 19:01:35
|
On Apr 17, 2004, at 1:37 PM, Clifton Royston wrote: > On Sat, Apr 17, 2004 at 11:44:45AM -0500, Puneet Kishor wrote: >> On Apr 17, 2004, at 11:25 AM, Karen J. Cravens wrote: >>> On Sat, 17 Apr 2004, Puneet Kishor wrote: >>> >>> PK>What is/are a typical circumstance(s) where I would not already >>> know >>> PK>what vars exist in a template and would want to use query to find >>> out? >>> >>> It's the split between template and programming thing. I've >>> considered >> >> On Apr 17, 2004, at 11:18 AM, Roger Burton West wrote: >> >>> On Sat, Apr 17, 2004 at 11:10:35AM -0500, Puneet Kishor wrote: >>> >>>> What is/are a typical circumstance(s) where I would not already know >>>> what vars exist in a template and would want to use query to find >>>> out? >>> >>> The most obvious case is the one in which someone else is being given >>> the HTML design part of the job. >> >> Interesting. I have approached this always with the attitude that I >> have to separate programming from display as much as possible. I've >> just finished a relatively complicated app -- a single cgi script >> about >> 2000 lines long, and about 45 different templates. My approach has >> been >> to create the templates in such a way that they could exist as a >> standalone website even if there was no H-T involved. In other words, >> if a designer-type decided to load the entire templates folder with >> its >> stylesheets and javascripts and whatnot in a designer-type program >> (GoLive or Dreamweaver, etc.), a complete, well-formed website would >> manifest, of course, with tmpl_vars intact. It may look a bit kooky >> since tables won't be fleshed out, and a few unavoidable tmpl_ifs >> won't >> be logic-ed out, but nonetheless -- it would be a website with all its >> links and scripts and behaviors and whatnot. > > That's exactly the approach I decided we should take for designing > our GUI. In fact, the final form of most of the templates was created > in Dreamweaver. > > On a similar principle, I made the various CGI scripts for displaying > the templates load the template with the name exactly corresponding to > the URL it's invoked under. That sounds a little confusing to say, but > it just means that if you go to an URL like /admin/home/news.html, the > CGI will pick up that URL and open and render a template from the path > .../templates/home/news.html. > > Clifton, That is really cool. Could you (here, or offline) share more about how you did this? In effect, the users are not going to index.cgi?do=somecrap, but they are going to /website/somecrap. So you can use path_info, but how are you getting the cgi to fire up? I know this can be accomplished somewhat with the help of mod_rewrite, but that is not always possible. I am very interested in knowing how you are accomplishing this. Thanks. |
From: Clifton R. <cli...@ti...> - 2004-04-17 18:37:51
|
On Sat, Apr 17, 2004 at 11:44:45AM -0500, Puneet Kishor wrote: > On Apr 17, 2004, at 11:25 AM, Karen J. Cravens wrote: > >On Sat, 17 Apr 2004, Puneet Kishor wrote: > > > >PK>What is/are a typical circumstance(s) where I would not already know > >PK>what vars exist in a template and would want to use query to find > >out? > > > >It's the split between template and programming thing. I've considered > > On Apr 17, 2004, at 11:18 AM, Roger Burton West wrote: > > >On Sat, Apr 17, 2004 at 11:10:35AM -0500, Puneet Kishor wrote: > > > >>What is/are a typical circumstance(s) where I would not already know > >>what vars exist in a template and would want to use query to find out? > > > >The most obvious case is the one in which someone else is being given > >the HTML design part of the job. > > Interesting. I have approached this always with the attitude that I > have to separate programming from display as much as possible. I've > just finished a relatively complicated app -- a single cgi script about > 2000 lines long, and about 45 different templates. My approach has been > to create the templates in such a way that they could exist as a > standalone website even if there was no H-T involved. In other words, > if a designer-type decided to load the entire templates folder with its > stylesheets and javascripts and whatnot in a designer-type program > (GoLive or Dreamweaver, etc.), a complete, well-formed website would > manifest, of course, with tmpl_vars intact. It may look a bit kooky > since tables won't be fleshed out, and a few unavoidable tmpl_ifs won't > be logic-ed out, but nonetheless -- it would be a website with all its > links and scripts and behaviors and whatnot. That's exactly the approach I decided we should take for designing our GUI. In fact, the final form of most of the templates was created in Dreamweaver. On a similar principle, I made the various CGI scripts for displaying the templates load the template with the name exactly corresponding to the URL it's invoked under. That sounds a little confusing to say, but it just means that if you go to an URL like /admin/home/news.html, the CGI will pick up that URL and open and render a template from the path .../templates/home/news.html. This approach has worked quite well for us. -- Clifton -- Clifton Royston -- cli...@ti... Tiki Technologies Lead Programmer/Software Architect Did you ever fly a kite in bed? Did you ever walk with ten cats on your head? Did you ever milk this kind of cow? Well we can do it. We know how. If you never did, you should. These things are fun, and fun is good. -- Dr. Seuss |