html-template-users Mailing List for HTML::Template (Page 64)
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: Timm M. <tm...@ag...> - 2003-12-08 14:14:44
|
HTML::Template doesn't really have "tags", it just looks that way. You=20 could make the tags look like comments instead: <!-- TMPL_VAR NAME=3DPARAM1 --> At 02:27 PM 12/8/03 +0100, paul POULAIN wrote: >Hi, > >For instance, h::t tags are not html valid <TMPL_VAR name=3D"X"> is NOT=20 >valid. It should be : <TMPL_VAR name=3D"X"/>. >Same thing for <TMPL_ELSE> : ><TMPL_IF name=3D"x"> >... ><TMPL_ELSE/> >... ></TMPL_IF> >would be valid. > >Is it possible to add this feature in a future version ? (with <TMPL_VAR >= =20 >still possible to avoid rewritting all templates, of course) > >Note : the Koha project uses H::T, i'm writting a "translator tool" with=20 >HTML::TreeBuilder, and TreeBuilder is a little bit lost with <tmpl_else> &= =20 ><tmpl_var> > >-- >Paul POULAIN >Consultant ind=E9pendant en logiciels libres >responsable francophone de koha (SIGB libre http://www.koha-fr.org) > > > > >------------------------------------------------------- >This SF.net email is sponsored by: IBM Linux Tutorials. >Become an expert in LINUX or just sharpen your skills. Sign up for IBM's >Free Linux Tutorials. Learn everything from the bash shell to sys admin. >Click now! >_______________________________________________ >Html-template-users mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: paul P. <pau...@fr...> - 2003-12-08 13:23:41
|
Hi, For instance, h::t tags are not html valid <TMPL_VAR name=3D"X"> is NOT=20 valid. It should be : <TMPL_VAR name=3D"X"/>. Same thing for <TMPL_ELSE> : <TMPL_IF name=3D"x"> ... <TMPL_ELSE/> ... </TMPL_IF> would be valid. Is it possible to add this feature in a future version ? (with <TMPL_VAR=20 > still possible to avoid rewritting all templates, of course) Note : the Koha project uses H::T, i'm writting a "translator tool" with=20 HTML::TreeBuilder, and TreeBuilder is a little bit lost with <tmpl_else>=20 & <tmpl_var> --=20 Paul POULAIN Consultant ind=E9pendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org) |
From: David W. <da...@ki...> - 2003-11-30 20:04:55
|
It gives me great pleasure to announce the release of Bricolage-Devel 1.7.1, the second development release for what will eventually become Bricolage 1.8.0. This version of the open-source content management system addresses all of the bugs discovered since the release of the first development release, 1.7.0. The most significant changes include: * Eliminated the need for the Apache::ConfigFile module, and thus some annoying problems with the CPAN indexer when trying to install it. [David] * Passwords can be changed again. [Mike Slattery] * It is now virtually impossible to create media type or story type elements without site and output channel associations. This should eliminate errors when users try to create documents based on types without output channel associations. [David] * The "Output Channel" item for templates on desks now displays properly. [David] * Eliminated bogus "Use of element's 'name' field is deprecated" warnings. Key names are allowed to have digits and underscores, and we weren't consistent about that. [David] * The "display_element()" method in the Mason burner once again passes component arguments on to components. And now, so does "sdisplay_element()". [David] * Fixed favicon.ico code so that the browser and server don't go into an infinite loop with redirects of redirects. The favicon.ico still doesn't pop up in the location field in my browser, but it does display properly if I point my browser at it. [David] * An attempt to create a document with the same URI as an existing document no longer litters the database with broken stories. Thanks to Arthur for the spot. [David] * Redirection after some publishes and previews works again, instead of returning a text page to the browser. [David] * Now displaying the name of the site each story and media document is in in Find Stories and Find Media. Suggested by Arthur. [David] * A number of fixes for the bric_media_upload contrib script: * Made it work with the 1.7.0 XML Schema. * Fixed a bug in its use of File::Find. * Fixed problem in calculating category names when given a directory to upload. * Added "--bric_soap" and "--site" options. See the script's usage info for details. [Dave Rolsky] * Changing a media item's category and then saving caused an error. [Dave Rolsky] * Changing a media document's cover date no longer causes the URI to disappear. Thanks to Dave Rolsky for the spot. [David] * Attempting to preview a story for which there are no associated destinations no longer causes the error 'Can't call method "ACCESS" without a package or object reference'. Thanks to Earle Martin for the spot! [David] * Added "output_channel_id" parameter to the "list()" method of Bric::Biz::Site in order to prevent sites without output channel associations from being listed in the select list for story type and media type elements. [David] * When a document fails to publish because there are no destinations configured, the UI no longer displays a message saying that it was published. [David] * Fixed page logging so that redirects to the page before the current page can work correctly. It was most noticeably broken when trying to associate a contributor with a document. [David] * The upgrade process no longer moves media document files to where Bricolage can't find them. If this happened to you, just "mv $BRICOLAGE_ROOT/comp.old/data $BRICOLAGE_ROOT/comp". [David] * Performing an action in the contributor and category association interfaces in the story and media profiles no longer causes an empty search to be performed and return all contributors or categories. This could be a pain for organizations with 1000s of contributors or categories. Thanks to Scott for the report! [David] * The Key Name field in the element profile is no longer editable. Only new elements can type in the key name field. Thanks to Arthur for the spot! [David] * The Template toolkit burner now correctly uses element key names instead of names to find corresponding templates. [David] * Management of user groups in a double list manager UI no longer causes an SQL error. Spotted by Alexander Ling. [David] * Sites added to a site group will now be listed as members of the site group in the site group's profile. Thanks to Alexander Ling for the spot. [David] * Improved permission checking in the virtual FTP server. [David] For a complete list of the changes, see the changes file at: http://sourceforge.net/project/shownotes.php?release_id=200856 ABOUT BRICOLAGE Bricolage is a full-featured, enterprise-class content management and publishing system. It offers a browser-based interface for ease-of use, a full-fledged templating system with complete HTML::Mason, HTML::Template, and Template Toolkit support for flexibility, and many other features. It operates in an Apache/mod_perl environment and uses the PostgreSQL RDBMS for its repository. A comprehensive, actively-developed open source CMS, Bricolage has been hailed as "Most Impressive" in 2002 by eWeek. Learn more about Bricolage and download it from the Bricolage home page, http://bricolage.cc/. Enjoy! David -- David Wheeler AIM: dwTheory da...@ki... ICQ: 15726394 http://www.kineticode.com/ Yahoo!: dew7e Jabber: Th...@ja... Kineticode. Setting knowledge in motion.[sm] |
From: David W. <da...@ki...> - 2003-11-30 02:38:48
|
I'm pleased to announce the release of Bricolage 1.6.8. This maintenance release addresses a few issues discovered since the release of version 1.6.7. Here is the complate list of chnages for this release: * Custom select fields now correctly pay attention to the size attribute. Reported by Dave Rolsky. [David] * The element type manager now displays "Subelement" instead of "Story" for subelement element types. Suggested by Dave Rolsky. [David] * Updated to work with PostgreSQL 7.4. [David] * Improved error message in Bric::Util::Trans::SFTP. [David] * It's possible to create new stories again without running into errors saying that a URI is not unique because the cover date and slug were accidentally excluded from the URI. [David] * Mason story templates now inherit from all category templates, thus enabling the access of "<%attr>"s and calling of "<%method>"s in category templates from story templates. [David] * Permission to edit element fields is now based on the permissions granted to edit the elements they belong to. This means that users other Global Admin group members can now edit fields. [David] * Dates are no longer editable if a user doesn't have permission to edit them. [David] * Users without EDIT access to an element no longer see a link to Edit fields of that element, but a link to View them, instead. They will also no longer see an "Add Subelements" button. [David] * Fixed bug that triggered an invalid error message when a story URI is non-unique. Reported by Kevin Elliott. [David] * Assets with the same IDs but in different classes (media vs. stories vs. templates) no longer prevent each other from being added to a desk that can contain different classes of assets. Thanks to Scott for the spot and doing the research that lead to the replication of the problem. [David] See the changes page for a complete history of Bricolage changes. http://sourceforge.net/project/shownotes.php?release_id=200747 ABOUT BRICOLAGE Bricolage is a full-featured, enterprise-class content management and publishing system. It offers a browser-based interface for ease-of use, a full-fledged templating system with complete HTML::Mason and HTML::Template support for flexibility, and many other features. It operates in an Apache/mod_perl environment, and uses the PostgreSQL RDBMS for its repository. A comprehensive, actively-developed open source CMS, Bricolage has been hailed as "Most Impressive" in 2002 by eWeek. Learn more about Bricolage and download it from the Bricolage home page, http://www.bricolage.cc/. Enjoy! David -- David Wheeler AIM: dwTheory da...@ki... ICQ: 15726394 http://www.kineticode.com/ Yahoo!: dew7e Jabber: Th...@ja... Kineticode. Setting knowledge in motion.[sm] |
From: Timm M. <tm...@ag...> - 2003-11-25 14:00:11
|
>><> >>The first two lines of my cgi script are: >> >>#!/usr/bin/perl -w >>use strict; >> >>When you say to "use -w", is that sufficient? > >well, no... I really meant what you already have > >#/usr/bin/perl -w >use strict; > >you can also "use diagnostics" or splain if you really want a chatty system. > >> What about if it's being >>run under mod_perl and Apache::Registry so that line isn't, as I >>understand it, being invoked. Does the perl still check to see if there >>are invocation flags on the first line and respect them? > >dunno. I don't use mod_perl or A::R. I am cc-ing this to the list (as you >should do also) because someone else would likely have the answer to this >(and other questions). You can put a 'use warnings;' instead of using -w. There are also places in the mod_perl config where you can modify what switches perl is invoked with. 'use warnings' has the advantage that it can be lexically scoped, so you can shut off warnings you know are harmless for a block. |
From: Andrew B. <an...@br...> - 2003-11-25 13:11:40
|
On 11/25/03 at 1:24 AM, pk...@ei... (Puneet Kishor) wrote: > > On Nov 25, 2003, at 1:18 AM, Ken Corey wrote: > > So, I'm using anonymous array and hash operators to make an anonymous > array of hash references. (page 246, "The anonymous array composer", > camel book). > > That's great, but what if you don't know your content at programming > time? > > > On Mon, 2003-11-24 at 20:19, Puneet Kishor wrote: > >> This comes up frequently. Maybe the explanation(s) should be added > >> to the H::T docs (htdocs!) > > > > Might be a good idea! > > yeah... maybe Sam T might consider adding something like what I wrote > up... something that directly ties using DBI with H::T, because > inevitably someone will want to use MySQL or some such. > Seems to me that it's a question of using Perl data structures and references, not really an H::T question. The H::T documentation is already far superior to many modules out there. You need to draw the line somewhere. Whatever. Andrew |
From: Puneet K. <pk...@ei...> - 2003-11-25 07:26:24
|
On Nov 25, 2003, at 1:18 AM, Ken Corey wrote: > On Mon, 2003-11-24 at 20:19, Puneet Kishor wrote: >> This comes up frequently. Maybe the explanation(s) should be added to >> the H::T docs (htdocs!) > > Might be a good idea! yeah... maybe Sam T might consider adding something like what I wrote up... something that directly ties using DBI with H::T, because inevitably someone will want to use MySQL or some such. > >> $template->param('result' => $sth->fetchall_arrayref({})); > > Thanks for pointing this out, the '({})' to arrayref would have thrown > me for a loop...uh...no pun intended. > >> You can construct this programmatically if you are reading >> sequentially >> from a file. > > Thanks, this info allowed me to get it working in less than 30 seconds. > Yay! I /knew/ it was something simple. > >> Please always use strict and -w. > > The first two lines of my cgi script are: > > #!/usr/bin/perl -w > use strict; > > When you say to "use -w", is that sufficient? well, no... I really meant what you already have #/usr/bin/perl -w use strict; you can also "use diagnostics" or splain if you really want a chatty system. > What about if it's being > run under mod_perl and Apache::Registry so that line isn't, as I > understand it, being invoked. Does the perl still check to see if > there > are invocation flags on the first line and respect them? > dunno. I don't use mod_perl or A::R. I am cc-ing this to the list (as you should do also) because someone else would likely have the answer to this (and other questions). |
From: Ken C. <ke...@ke...> - 2003-11-25 07:10:19
|
On Mon, 2003-11-24 at 20:19, Puneet Kishor wrote: > This comes up frequently. Maybe the explanation(s) should be added to > the H::T docs (htdocs!) Might be a good idea! > $template->param('result' => $sth->fetchall_arrayref({})); Thanks for pointing this out, the '({})' to arrayref would have thrown me for a loop...uh...no pun intended. > You can construct this programmatically if you are reading sequentially > from a file. Thanks, this info allowed me to get it working in less than 30 seconds. Yay! I /knew/ it was something simple. > Please always use strict and -w. The first two lines of my cgi script are: #!/usr/bin/perl -w use strict; When you say to "use -w", is that sufficient? What about if it's being run under mod_perl and Apache::Registry so that line isn't, as I understand it, being invoked. Does the perl still check to see if there are invocation flags on the first line and respect them? Hrm... -Ken |
From: Puneet K. <pk...@ei...> - 2003-11-24 20:14:38
|
Ken Corey wrote: > Hi All, > > I'm playing with HTML::Template, and I've run into something that should > be easy, but I don't see how it can work. > > The docs say to pass many elements for a loop, you do this: > > $template->param( loopvar => [ > { name=>"foo",value=>"baloney" }, > { name=>"bar",value=>"tiple" }, > { name=>"blah",value=>"mulroney" }, > ], > ); > > So, I'm using anonymous array and hash operators to make an anonymous > array of hash references. (page 246, "The anonymous array composer", > camel book). > > That's great, but what if you don't know your content at programming > time? This comes up frequently. Maybe the explanation(s) should be added to the H::T docs (htdocs!) Apologies if you already know some of the following. A 2-d table (columns x rows) is a common, dareisay, the only representation of a database table. That is how you will also (in all likelihood) display it on your html page. So, imagine that each row is a hash where each key is the fieldname, and the value is the value of that field for that row. Now, if you string up a bunch of such hashes in a list, you get an array of hashes. Of course, since an array can store only scalara, it is actually an array of refs to hashes. And, since the $template->param is nothing but a hash itself, and since value of a key in a hash is also a scalar, a ref to our array of refs to hashes is applied. So, you have $template->param('result' => $arrayref); where arrayref is a ref to our array of refs to hashes. If you are using DBI (which is what you would typically, to grab the data from a table), things get extremely easy. The $sth->fetchall_arrayref({}) conveniently fetches a ref to an array of refs to hashes... cool. so, $template->param('result' => $sth->fetchall_arrayref({})); works groovy. You can construct this programmatically if you are reading sequentially from a file. my @result; while (<FILE>) { my %row; .. .. do something to split the row and stuff it into %row .. .. push(@result, \%row); } $template->param('result' => \@result); The main problem is if you don't know the names of the fields you are pulling from a table (such as you would if you were to SELECT * FROM table). Since the fieldnames become the hash keynames, you would not be able to display them in your html page, because you wouldn't know what you pulled. To get around this, you simply treat each row as an array of hashes where each hash contains only one key called 'field' (or whatever), and its value is the value of that field. So you end up with an array of hashes where each hash is an array of hashes where each hash is a single field and its value. Cool. Please always use strict and -w. Hth. |
From: Jayson P. <JP...@je...> - 2003-11-24 20:05:38
|
Attempt #1-3 are missing a comma between your array and your list. Solution, use a comma. Attempt #4 is assigning an array reference as the first element of an array and then you are using a reference to that array. Solution, use () instead of [] in your assignment. Attempt #5 is a hashref not an array ref. Solution, put all your hash elements into an array. Attempt #6 is a hash itself, not even an array. I'd recommend using #1 with a comma like so (push @test, { name=3D>"foo",value=3D>"blitz" };) and you should be working. --Jayson Ken Corey <ke...@ke...> Sent by: htm...@li... 11/24/03 02:55 PM To: htm...@li... cc: Subject: [htmltmpl] (newbie) How to populate an array of hash references one by one=3F Hi All, I'm playing with HTML::Template, and I've run into something that should be easy, but I don't see how it can work. The docs say to pass many elements for a loop, you do this: $template->param( loopvar =3D> [ { name=3D>"foo",value=3D>"baloney" }, { name=3D>"bar",value=3D>"tiple" }, { name=3D>"blah",value=3D>"mulroney" }, ], ); So, I'm using anonymous array and hash operators to make an anonymous array of hash references. (page 246, "The anonymous array composer", camel book). That's great, but what if you don't know your content at programming time=3F {Just for context, I'm using perl 5.6.1, HTML::Template 2.6, with "use strict"}. Ideally, I want to add a line at a time to that array, and then pass that whole array to the param. So, I tried various things: # attempt 1 my @test =3D (); push @test { name=3D>"foo",value=3D>"blitz" }; # Gets "Global symbol "%test" requires explicit package name at ...[push line]" !=3F!=3F! there is no %test. # attempt 2 my @test =3D (); push @test \{ name=3D>"foo",value=3D>"blitz" }; # Gets "Backslash found where operator expected at ...[push line]" # attempt 3 my @test =3D (); push @test [ { name=3D>"foo",value=3D>"blitz" } ]; # Gets "Type of arg 1 to push must be array (not array slice) at ...[push line]" [more stuff along the same lines that didn't work...] *grrr* Okay, says I, I'll work on something else and wait for the muse to strike. I decide I'll figure out how to pass an array into a param... # attempt 4 my @test =3D [ { a=3D>"b",c=3D>"d" }, { e=3D>"f",g=3D>"h" }, ]; $template->param(itemloop =3D> \@test); # Gets "HTML::Template->output() : fatal error in loop output : HTML::Template->param() : Single reference arg to param() must be a has-ref! You gave me a ARRAY. at ..." # attempt 5 my %test; $test{"a"}=3D"b"; $test{"c"}=3D"d"; $test{"e"}=3D"f"; $template->param(itemloop =3D> \%test); # Gets "HTML::Template::param() : attempt to set parameter 'itemloop' with a scalar - parameter is not a TMPL=5FVAR! at ..." # attempt 6 my %test; $test{"a"}=3D"b"; $test{"c"}=3D"d"; $test{"e"}=3D"f"; $template->param(itemloop =3D> %test); # Gets "You gave me an odd number of parameters to param()! at ..." Ach. So, no better luck. Clearly there's some simple skullduggery I'm missing here. Can anyone enlighten me=3F Pointers to documentation would be fine, though the HTML::Template page and the perldoc for HTML::Template didn't help too much already. -Ken ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive=3F Does it help you create better code=3F SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Html-template-users mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/html-template-users Jefferies archives and reviews outgoing and incoming e-mail. It may be prod= uced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a resu= lt of transmission. Use by other than intended recipients is prohibited. |
From: Timm M. <tm...@ag...> - 2003-11-24 20:03:37
|
><> ># attempt 1 >my @test = (); >push @test { name=>"foo",value=>"blitz" }; ># Gets "Global symbol "%test" requires explicit package name at ...[push >line]" !?!?! there is no %test. You forgot a comma, so Perl interpreted it as something like this: push @test{'name','foo',value','blitz'}; Adding a comma after @test will make it work ># attempt 2 >my @test = (); >push @test \{ name=>"foo",value=>"blitz" }; ># Gets "Backslash found where operator expected at ...[push line]" This would have made a reference to a hash reference (if you had the comma in), which wouldn't have worked anyway. ><> ># attempt 4 >my @test = [ > { a=>"b",c=>"d" }, > { e=>"f",g=>"h" }, >]; >$template->param(itemloop => \@test); ># Gets "HTML::Template->output() : fatal error in loop output : >HTML::Template->param() : Single reference arg to param() must be a >has-ref! You gave me a ARRAY. at ..." To Perl, you're creating an array, the first element being an arrayref, which contains hashrefs. What you actually wanted to do is: my @test = ( { a=>"b",c=>"d" }, { e=>"f",g=>"h" }, ); Note parens instead of square brackets. ># attempt 5 >my %test; >$test{"a"}="b"; >$test{"c"}="d"; >$test{"e"}="f"; >$template->param(itemloop => \%test); ># Gets "HTML::Template::param() : attempt to set parameter 'itemloop' >with a scalar - parameter is not a TMPL_VAR! at ..." This one is interesting. Looks like HTML::Template trys to use the hashref in its scalar representation (like HASH(0xffffffff)) and then errors out when your param isn't a loop. ># attempt 6 >my %test; >$test{"a"}="b"; >$test{"c"}="d"; >$test{"e"}="f"; >$template->param(itemloop => %test); ># Gets "You gave me an odd number of parameters to param()! at ..." To Perl, your params are being flatened like this: $template->param(itemloop => a, b => 'c', d => 'e', f ); That's because the param method takes a list with all the parameters being flattened into a hash. Since you're putting 'itemloop => ' first, Perl sees that as the first element in the hash. That's why you need to use references. Please read perldsc. <> |
From: Philip S T. <phi...@gm...> - 2003-11-24 20:00:13
|
Sometime on Nov 24, Ken Corey assembled some asciibets to say: > # attempt 1 > my @test = (); > push @test { name=>"foo",value=>"blitz" }; ^^^ missing comma. you're referring to the hash %test, and trying to retrieve keys name, foo, value and blitz. ie, you're trying to get the array formed out of the values ($test{'name'}, $test{'foo'}, $test{'value'}, $test{'blitz'}); > # Gets "Global symbol "%test" requires explicit package name at ...[push > line]" !?!?! there is no %test. > > # attempt 2 > my @test = (); > push @test \{ name=>"foo",value=>"blitz" }; same here. > # Gets "Backslash found where operator expected at ...[push line]" > > # attempt 3 > my @test = (); > push @test [ { name=>"foo",value=>"blitz" } ]; ditto > # Gets "Type of arg 1 to push must be array (not array slice) at > ...[push line]" are you using the -w flag? -- And now for something completely different. |
From: Ken C. <ke...@ke...> - 2003-11-24 19:47:38
|
Hi All, I'm playing with HTML::Template, and I've run into something that should be easy, but I don't see how it can work. The docs say to pass many elements for a loop, you do this: $template->param( loopvar => [ { name=>"foo",value=>"baloney" }, { name=>"bar",value=>"tiple" }, { name=>"blah",value=>"mulroney" }, ], ); So, I'm using anonymous array and hash operators to make an anonymous array of hash references. (page 246, "The anonymous array composer", camel book). That's great, but what if you don't know your content at programming time? {Just for context, I'm using perl 5.6.1, HTML::Template 2.6, with "use strict"}. Ideally, I want to add a line at a time to that array, and then pass that whole array to the param. So, I tried various things: # attempt 1 my @test = (); push @test { name=>"foo",value=>"blitz" }; # Gets "Global symbol "%test" requires explicit package name at ...[push line]" !?!?! there is no %test. # attempt 2 my @test = (); push @test \{ name=>"foo",value=>"blitz" }; # Gets "Backslash found where operator expected at ...[push line]" # attempt 3 my @test = (); push @test [ { name=>"foo",value=>"blitz" } ]; # Gets "Type of arg 1 to push must be array (not array slice) at ...[push line]" [more stuff along the same lines that didn't work...] *grrr* Okay, says I, I'll work on something else and wait for the muse to strike. I decide I'll figure out how to pass an array into a param... # attempt 4 my @test = [ { a=>"b",c=>"d" }, { e=>"f",g=>"h" }, ]; $template->param(itemloop => \@test); # Gets "HTML::Template->output() : fatal error in loop output : HTML::Template->param() : Single reference arg to param() must be a has-ref! You gave me a ARRAY. at ..." # attempt 5 my %test; $test{"a"}="b"; $test{"c"}="d"; $test{"e"}="f"; $template->param(itemloop => \%test); # Gets "HTML::Template::param() : attempt to set parameter 'itemloop' with a scalar - parameter is not a TMPL_VAR! at ..." # attempt 6 my %test; $test{"a"}="b"; $test{"c"}="d"; $test{"e"}="f"; $template->param(itemloop => %test); # Gets "You gave me an odd number of parameters to param()! at ..." Ach. So, no better luck. Clearly there's some simple skullduggery I'm missing here. Can anyone enlighten me? Pointers to documentation would be fine, though the HTML::Template page and the perldoc for HTML::Template didn't help too much already. -Ken |
From: Timm M. <tm...@ag...> - 2003-11-20 16:34:25
|
As previously discussed on Perl Monks (http://www.perlmonks.org/index.pl?node_id=307736), HTML::Template::Dumper is almost ready for upload on CPAN. This module subclasses HTML::Template to dump out the data structure used to fill in the template in a serialized form. Once a remote script deserializes the stream, writing tests against it is as easy as walking the resulting hash. Note that this has nothing to do with the overall design of the page. For that, you really need a human. This module only deals with the output that would go into TMPL_* tags. The underlining HTML::Template methods for new(), param(), and output() are still called, so the template data is loaded and attributes like 'strict' and 'die_on_bad_params' are still respected. The POD has changed slightly since the posting above on Perl Monks, though most things are the same. I'll have this up on CPAN soon. PAUSE doesn't seem to be working ATM. Until then, I have a temporary downloads here: http://www.wumpus-cave.net/downloads/HTML-Template-Dumper-0.1.tar.gz http://www.wumpus-cave.net/downloads/HTML-Template-Dumper-0.1.tar.bz2 This was developed internally by me at my employer (the American Society of Agronomy, www.agronomy.org), who graciously allowed it to be made into a public release. Thanks, Timm Murray |
From: Sam T. <sa...@tr...> - 2003-11-20 16:09:20
|
On Thu, 20 Nov 2003, Chisel Wright wrote: > What'd I'd like to do is have access to $self in _filter_sections() so I > can have something along these lines: No problem. Just create a little anonymous sub when you setup the filter. 'filter' => [ { 'sub' => sub { $self->_filter_sections(@_) }, 'format' => 'scalar' }, This is called a closure because it captures the lexical value of $self and keeps it around for when the sub is called. -sam |
From: Chris <chr...@co...> - 2003-11-20 14:11:00
|
Thank you everybody for your excellent help! Removing just HTML:Template-> did the trick!! And yes, this was real code from a script, but it was only a test script. I always use strict :) Thanks again everybody, everything is working great because of you all, especially Matt. Thanks!! > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of Sam > Tregar > Sent: Thursday, November 20, 2003 1:46 AM > To: Chris > Cc: Mathew Robertson; htm...@li... > Subject: RE: [htmltmpl] Comparing H::T:Expr variables > > > On Wed, 19 Nov 2003, Chris wrote: > > > my $template = HTML::Template->new(filename => 'index.tmpl', > strict => 0, > > global_vars => 1); > > You're calling HTML::Template->new(), but you should be calling > HTML::Template::Expr->new(). > > -sam > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Chisel W. <ch...@he...> - 2003-11-20 11:19:16
|
Hi, I've just hit a mental block, and I don't know if it's something that's not possible, or I'm just being stupid. I'm using H::T wrapped inside a package: sub template($$) { ... $self->{'tpl'} = HTML::Template->new( ... 'filter' => [ { 'sub' => \&_filter_sections, 'format' => 'scalar' }, ], ); } What'd I'd like to do is have access to $self in _filter_sections() so I can have something along these lines: sub _filter_sections { ... my $section = $self->{'_conf'}{'section'} || 'some default value'; $$textref =~ s/\[%\s+section\s+%\]/$section/g; } I've read the H::T podumentation, and can't see anything that says this is possible. Is it? If not any suggestions how to achieve the same effect a different way. I'm loathe to use gloabal variables unless I really have to, Thanks in advance, Chisel -- e: ch...@he... | The Victorian game of knocking on w: http://www.herlpacker.co.uk/ | somebody's door and running away is gpg: D167E7FE | called "Parcel Force". |
From: Sam T. <sa...@tr...> - 2003-11-20 05:45:25
|
On Wed, 19 Nov 2003, Chris wrote: > my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, > global_vars => 1); You're calling HTML::Template->new(), but you should be calling HTML::Template::Expr->new(). -sam |
From: Todd C. <htm...@ch...> - 2003-11-20 05:41:29
|
Remove the "use HTML::Template" line. Keep the "HTML::Template::Expr" line. -Todd On Wed, Nov 19, 2003 at 11:32:29PM -0500, Chris wrote: > Hi Matt, Thanks for all your help. > > I just added the strict option on: > > my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, > global_vars => 1); > > And now I get the following error: > > HTML::Template->new() : found <//TMPL_IF> with no matching <TMPL_IF> at > index.tmpl : line 16. at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm > line 2117. > > > I will include my HTML template and source: > > HTML Template: > <TMPL_LOOP ROWS> > <br> > <br> > <TMPL_VAR NAME=MODEL_NAME> > <br> > <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100> > <br> > Can be seen at: > <TMPL_LOOP URLLOOP> > Model Name: <TMPL_VAR NAME=MODEL_NAME> > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> > Model Name: <TMPL_VAR NAME=MODEL_NAME> > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > The URL on match: <TMPL_VAR NAME=MODEL_URL> > </TMPL_IF> > </TMPL_LOOP> > </TMPL_LOOP> > <br> > > > The Perl Script: > #!/usr/bin/perl > use DBI; > use CGI; > use HTML::Template; > use HTML::Template::Expr; > > my $dbsource = "DBI:mysql:dbname=msearch;host=localhost"; > my $dbuser = "chrisp"; > my $dbpasswd = "xxxxxxxx"; > > my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, > global_vars => 1); > my $bychar = 'c'; > my @URLS = (); > my @ROWS = (); > > my $dbh = DBI->connect($dbsource, $dbuser, $dbpasswd); > my $dbh2 = DBI->connect($dbsource, $dbuser, $dbpasswd); > > my $query = "SELECT DISTINCT model_name as model_name, model_thumb FROM > models WHERE model_firstchar = '$bychar' GROUP BY model_name"; > my $sth = $dbh->prepare($query); > $sth->execute() || die &error($DBI::errstr); > > while (my $data = $sth->fetchrow_hashref) { > $model_name = $data->{model_name}; > > my $query2 = "SELECT model_url FROM models where model_name = > '$model_name'"; > my $sth2 = $dbh2->prepare($query2); > > $sth2->execute(); > $sth2->bind_columns(undef, \$model_url); > > while($sth2->fetch()) { > push (@URLS, { MODEL_URL => $model_url, MODEL_COMP => > $data->{model_name} }); > } > > push (@ROWS, { MODEL_NAME => $data->{model_name}, > MODEL_THUMB => $data->{model_thumb}, > URLLOOP => \@URLS, > }); > } > > $sth->finish(); > > $template->param( ROWS => \@ROWS ); > print $template->output; > > I really dont know why H::T is complaining about finding a <//TMPL_IF> > without a <TMPL_IF>, since there is, indeed one there. > > Thanks! > > > > -----Original Message----- > > From: htm...@li... > > [mailto:htm...@li...]On Behalf Of > > Mathew Robertson > > Sent: Wednesday, November 19, 2003 10:42 PM > > To: Chris; htm...@li... > > Subject: Re: [htmltmpl] Comparing H::T:Expr variables > > > > > > The syntax that you are using is correct. I suspect that there > > is another error some where. > > > > What happens if you use the 'strict => 0' option to HTML::Template? > > > > Mat > > > > > > > Yes I did forget the " before the EXPR but it still fails with: > > > > > > <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> > > > > > > With the following error: > > > > > > HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : > 14. > > > at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. > > > > > > > > The new template file looks like: > > > > > > > > > > <TMPL_LOOP ROWS> > > > > > <br> > > > > > <br> > > > > > <TMPL_VAR NAME=MODEL_NAME> > > > > > <br> > > > > > <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 > > width=100> > > > > > <br> > > > > > Can be seen at: > > > > > > > > > > <TMPL_LOOP URLLOOP> > > > > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > > > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > > > > > > > > > <TMPL_IF EXPR=MODEL_COMP eq MODEL_NAME"> > > > > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > > > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > > > > The URL on match: <TMPL_VAR NAME=MODEL_URL> > > > > > </TMPL_IF> > > > > > </TMPL_LOOP> > > > > > > > > > > </TMPL_LOOP> > > > > > <br> > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. > > Does SourceForge.net help you be more productive? Does it > > help you create better code? SHARE THE LOVE, and help us help > > YOU! Click Here: http://sourceforge.net/donate/ > > _______________________________________________ > > Html-template-users mailing list > > Htm...@li... > > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Mathew R. <mat...@re...> - 2003-11-20 05:13:44
|
Hi Chris, I am assuming that this snippets of script/template are not exactly the = same as your real code? If so, you reeeealllly should be calling 'use strict;' since I can see = that there are vairable definitions here that are not declared before = use. Perl will quite happily do this, thus auto-vivifying some of these = variables into globals - probably not what you really want to happen. Also, didn't you say that you were using HTML::Template::Expr > my $template =3D HTML::Template->new(filename =3D> 'index.tmpl', = strict =3D> 0,global_vars =3D> 1); > I really dont know why H::T is complaining about finding a <//TMPL_IF> > without a <TMPL_IF>, since there is, indeed one there. This complaint was because I told you to use "strict =3D> 0" thus H::T = is ignoring the <TMPL_IF EXPR....>, thus hitting the </TMPL_IF> without = finding the <TMPL_IF...>. Ignore this - this was expected, and thus = confirmed that the error was with the TMPL_IF. Try using H::T::E rather than H::T ? Mat > I will include my HTML template and source: >=20 > HTML Template: > <TMPL_LOOP ROWS> > <br> > <br> > <TMPL_VAR NAME=3DMODEL_NAME> > <br> > <img src=3D"<TMPL_VAR NAME=3DMODEL_THUMB>" border=3D0 = height=3D100 width=3D100> > <br> > Can be seen at: > <TMPL_LOOP URLLOOP> > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> > <TMPL_IF EXPR=3D"MODEL_COMP eq MODEL_NAME"> > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> > The URL on match: <TMPL_VAR NAME=3DMODEL_URL> > </TMPL_IF> > </TMPL_LOOP> > </TMPL_LOOP> > <br> >=20 >=20 > The Perl Script: > #!/usr/bin/perl > use DBI; > use CGI; > use HTML::Template; > use HTML::Template::Expr; >=20 > my $dbsource =3D "DBI:mysql:dbname=3Dmsearch;host=3Dlocalhost"; > my $dbuser =3D "chrisp"; > my $dbpasswd =3D "xxxxxxxx"; >=20 > my $template =3D HTML::Template->new(filename =3D> 'index.tmpl', = strict =3D> 0, global_vars =3D> 1); > my $bychar =3D 'c'; > my @URLS =3D (); > my @ROWS =3D (); >=20 > my $dbh =3D DBI->connect($dbsource, $dbuser, $dbpasswd); > my $dbh2 =3D DBI->connect($dbsource, $dbuser, $dbpasswd); >=20 > my $query =3D "SELECT DISTINCT model_name as model_name, model_thumb = FROM models WHERE model_firstchar =3D '$bychar' GROUP BY model_name"; > my $sth =3D $dbh->prepare($query); > $sth->execute() || die &error($DBI::errstr); >=20 > while (my $data =3D $sth->fetchrow_hashref) { > $model_name =3D $data->{model_name}; >=20 > my $query2 =3D "SELECT model_url FROM models where model_name = =3D '$model_name'"; > my $sth2 =3D $dbh2->prepare($query2); >=20 > $sth2->execute(); > $sth2->bind_columns(undef, \$model_url); >=20 > while($sth2->fetch()) { > push (@URLS, > { > MODEL_URL =3D> $model_url, > MODEL_COMP =3D> $data->{model_name} > } ); > } >=20 > push (@ROWS, > { > MODEL_NAME =3D> $data->{model_name}, > MODEL_THUMB =3D> $data->{model_thumb}, > URLLOOP =3D> \@URLS, > } > ); > } >=20 > $sth->finish(); >=20 > $template->param( ROWS =3D> \@ROWS ); > print $template->output; >=20 |
From: Cees H. <ce...@si...> - 2003-11-20 05:11:08
|
Quoting Chris <chr...@co...>: > I just added the strict option on: > > my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, > global_vars => 1); You do mean HTML::Template::Expr in the above code right? You are getting the error because HTML::Template can't parse <TMPL_IF EXPR=""> correctly, so it sees a </TMPL_IF> without a matching <TMPL_IF> Cheers, Cees |
From: Chris <chr...@co...> - 2003-11-20 04:34:03
|
Hi Matt, Thanks for all your help. I just added the strict option on: my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, global_vars => 1); And now I get the following error: HTML::Template->new() : found <//TMPL_IF> with no matching <TMPL_IF> at index.tmpl : line 16. at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2117. I will include my HTML template and source: HTML Template: <TMPL_LOOP ROWS> <br> <br> <TMPL_VAR NAME=MODEL_NAME> <br> <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100> <br> Can be seen at: <TMPL_LOOP URLLOOP> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME=MODEL_COMP> <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> Model Name: <TMPL_VAR NAME=MODEL_NAME> Model Comp: <TMPL_VAR NAME=MODEL_COMP> The URL on match: <TMPL_VAR NAME=MODEL_URL> </TMPL_IF> </TMPL_LOOP> </TMPL_LOOP> <br> The Perl Script: #!/usr/bin/perl use DBI; use CGI; use HTML::Template; use HTML::Template::Expr; my $dbsource = "DBI:mysql:dbname=msearch;host=localhost"; my $dbuser = "chrisp"; my $dbpasswd = "xxxxxxxx"; my $template = HTML::Template->new(filename => 'index.tmpl', strict => 0, global_vars => 1); my $bychar = 'c'; my @URLS = (); my @ROWS = (); my $dbh = DBI->connect($dbsource, $dbuser, $dbpasswd); my $dbh2 = DBI->connect($dbsource, $dbuser, $dbpasswd); my $query = "SELECT DISTINCT model_name as model_name, model_thumb FROM models WHERE model_firstchar = '$bychar' GROUP BY model_name"; my $sth = $dbh->prepare($query); $sth->execute() || die &error($DBI::errstr); while (my $data = $sth->fetchrow_hashref) { $model_name = $data->{model_name}; my $query2 = "SELECT model_url FROM models where model_name = '$model_name'"; my $sth2 = $dbh2->prepare($query2); $sth2->execute(); $sth2->bind_columns(undef, \$model_url); while($sth2->fetch()) { push (@URLS, { MODEL_URL => $model_url, MODEL_COMP => $data->{model_name} }); } push (@ROWS, { MODEL_NAME => $data->{model_name}, MODEL_THUMB => $data->{model_thumb}, URLLOOP => \@URLS, }); } $sth->finish(); $template->param( ROWS => \@ROWS ); print $template->output; I really dont know why H::T is complaining about finding a <//TMPL_IF> without a <TMPL_IF>, since there is, indeed one there. Thanks! > -----Original Message----- > From: htm...@li... > [mailto:htm...@li...]On Behalf Of > Mathew Robertson > Sent: Wednesday, November 19, 2003 10:42 PM > To: Chris; htm...@li... > Subject: Re: [htmltmpl] Comparing H::T:Expr variables > > > The syntax that you are using is correct. I suspect that there > is another error some where. > > What happens if you use the 'strict => 0' option to HTML::Template? > > Mat > > > > Yes I did forget the " before the EXPR but it still fails with: > > > > <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> > > > > With the following error: > > > > HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : 14. > > at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. > > > > > > The new template file looks like: > > > > > > > > <TMPL_LOOP ROWS> > > > > <br> > > > > <br> > > > > <TMPL_VAR NAME=MODEL_NAME> > > > > <br> > > > > <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 > width=100> > > > > <br> > > > > Can be seen at: > > > > > > > > <TMPL_LOOP URLLOOP> > > > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > > > > > > > <TMPL_IF EXPR=MODEL_COMP eq MODEL_NAME"> > > > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > > > The URL on match: <TMPL_VAR NAME=MODEL_URL> > > > > </TMPL_IF> > > > > </TMPL_LOOP> > > > > > > > > </TMPL_LOOP> > > > > <br> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users |
From: Mathew R. <mat...@re...> - 2003-11-20 03:42:45
|
The syntax that you are using is correct. I suspect that there is = another error some where. What happens if you use the 'strict =3D> 0' option to HTML::Template? =20 Mat > Yes I did forget the " before the EXPR but it still fails with: >=20 > <TMPL_IF EXPR=3D"MODEL_COMP eq MODEL_NAME"> >=20 > With the following error: >=20 > HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : = 14. > at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. >=20 > > > The new template file looks like: > > > > > > <TMPL_LOOP ROWS> > > > <br> > > > <br> > > > <TMPL_VAR NAME=3DMODEL_NAME> > > > <br> > > > <img src=3D"<TMPL_VAR NAME=3DMODEL_THUMB>" border=3D0 height=3D100 = width=3D100> > > > <br> > > > Can be seen at: > > > > > > <TMPL_LOOP URLLOOP> > > > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > > > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> > > > > > > <TMPL_IF EXPR=3DMODEL_COMP eq MODEL_NAME"> > > > Model Name: <TMPL_VAR NAME=3DMODEL_NAME> > > > Model Comp: <TMPL_VAR NAME=3DMODEL_COMP> > > > The URL on match: <TMPL_VAR NAME=3DMODEL_URL> > > > </TMPL_IF> > > > </TMPL_LOOP> > > > > > > </TMPL_LOOP> > > > <br> |
From: Chris <chr...@co...> - 2003-11-20 03:28:43
|
Hi Matt, Yes I did forget the " before the EXPR but it still fails with: <TMPL_IF EXPR="MODEL_COMP eq MODEL_NAME"> With the following error: HTML::Template->new() : Syntax error in <TMPL_*> tag at index.tmpl : 14. at /usr/lib/perl5/site_perl/5.8.0/HTML/Template.pm line 2243. Thanks!! > -----Original Message----- > From: Mathew Robertson [mailto:mat...@re...] > Sent: Wednesday, November 19, 2003 8:24 PM > To: Chris; htm...@li... > Subject: Re: [htmltmpl] Comparing H::T:Expr variables > > > > The new template file looks like: > > > > <TMPL_LOOP ROWS> > > <br> > > <br> > > <TMPL_VAR NAME=MODEL_NAME> > > <br> > > <img src="<TMPL_VAR NAME=MODEL_THUMB>" border=0 height=100 width=100> > > <br> > > Can be seen at: > > > > <TMPL_LOOP URLLOOP> > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > > > <TMPL_IF EXPR=MODEL_COMP eq MODEL_NAME"> > > Model Name: <TMPL_VAR NAME=MODEL_NAME> > > Model Comp: <TMPL_VAR NAME=MODEL_COMP> > > The URL on match: <TMPL_VAR NAME=MODEL_URL> > > </TMPL_IF> > > </TMPL_LOOP> > > > > </TMPL_LOOP> > > <br> > > It looks like you are missing a " after the EXPR ...? > Mat |
From: Mathew R. <mat...@re...> - 2003-11-20 01:45:56
|
> Wouldn't that error be HTML::Template::Expr->new() if you're using = Expr? No, the HTML::Template module (rightly or wrongly) uses a hard-coded = text string for the wording "HTML::Template", rather than using = "ref($self)". This is not such a bad thing as it tell you exactly which module the = error is being generated in. Mat |