fmpp-open Mailing List for FMPP: FreeMarker-based File PreProcessor (Page 5)
Brought to you by:
ddekany
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(23) |
Aug
(4) |
Sep
(11) |
Oct
(7) |
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(2) |
Dec
|
| 2005 |
Jan
(2) |
Feb
(9) |
Mar
|
Apr
(1) |
May
|
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2006 |
Jan
(2) |
Feb
(14) |
Mar
(4) |
Apr
|
May
(6) |
Jun
(7) |
Jul
(7) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
(3) |
| 2010 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Ralf H. <ral...@gm...> - 2005-02-27 19:25:22
|
Thx - looks nice. Will look at it once it has been released!
> -----Original Message-----
> From: Daniel Dekany [mailto:dd...@fr...]
...
> Now that you already did it ;), it's actually even simpler in the latest
> version (it's in the CVS), because now rows are not only hashes, but are
> also the sequences of the cells:
>
> <#list n_xml as d>
> ...
> VALUES (<#list d as x>'${x}'<#if x_has_next>,</#if></#list>)
> ...
> </#list>
> >> >> >> > Basically I want not to access the columns of the table by
> >> >> >> > name, but by position. E.g. instead of
> >> >> >> > <#list flowers as flower>
> >> >> >> > <tr><td>${flower.name}...
> >> >> >> > as in
> >> http://fmpp.sourceforge.net/dataloader.html#key_csv, I would
> >> >> >> > want to just access
> >> >> >> > <#list flowers as flower>
> >> >> >> > <tr><td>${flower.1}...
> >> >> >> > and "1" being column 1
> >> >> >> >
> >> >> >> > Also, I would need an inner loop if I not only don't want to
> >> >> >> > use the column name to access the field values, but also don't
> >> >> >> > know ahead of time many how columns there are.
> >> >> >>
> >> >> >> You can use the "headers" sub-variable to dynamically query the
> >> >> >> number of columns and the name of columns.
> >> >> >
> >> >> >> OK, you don't have names... actually
> >> >> >> it's a problem that annoys me for a while, since it's sometimes
>
> >> >> >> not easy to ensure that the first row with header names exists...
> >> >> >> I will look into this tomorrow. I hope...
> >> >> > That is a different topic - I do have the names, but I do not want
> >> >> > to hard-code them. I want to have a generic csv2sql converter
> >> >> > macro that can handle csv files with varying numbers of columns.
> >> >> > Questions:
> >> >> > 1) How do I access the size of the "headers" subvariable?
> >> >> Like the size of any other sequences... theSequence?size
> >> >>
> >> >> > 2) And how would I access the i-th column-field in a row - I guess
> >> >> > ${flower.i} is not correct?
> >> >> Currently you have to use the name from the header. So,
> >> >> ${flower[headers[i]]}, where the "headers" variable was set to
> >> >> theCvsThing.headers.
> >> > I guess we are almost there:
> >> > <#assign n_xml = pp.loadData("csv", dataFile,{'separator':','})>
> >> > <#assign numbOfCols = n_xml.headers?size />
> >> > <#assign headers = n_xml.headers />
> >>
> >> (Well, you don't use this variable... so why you assign it.)
> >>
> >> > <#assign tbl = "TBL_GLOBALS" />
> >> > <#list n_xml as d>
> >> > INSERT INTO ${tbl} (<#list n_xml.headers as x>${x}<#if
> >> > x_has_next>,</#if></#list>) VALUES (<#list 1..numbOfCols as
> >> x>>'${d[headers[x]]}'<#if
> >> > x_has_next>,</#if></#list>);
> >> FreeMarker indices from 0. So, 1..numbOfCols-1. But anyway, you
> >> actually don't need here to get the values by numerical index. So just:
> >> <#list n_xml.headers as x>'${d[x]}'</#list>
> >> > </#list>
> >> >
> >> > Results after the first iteration in:
> >> > Expression headers[x] is undefined on line 7, column 72 in ...
> >> > so, it appears that the headers moves along as the loader iterates
> >> > through the data row?
> >> >
> >> > So the first line of output INSERT INTO TBL_GLOBALS
> >> > (id,keyname,val,category,lang_id,datatype) VALUES
> >> > ('URI','https://localhost/','mail','0','String','
> >> > appears to be correct!
> >> >>
> >> >> But I guess I will change it so it will be possible to do it with
> >> >> directly with integer index as well.
|
|
From: Daniel D. <dd...@fr...> - 2005-02-27 13:15:04
|
Thursday, February 24, 2005, 7:26:19 AM, Ralf Hauser wrote: > Hi, > > How can one easily iterate through lines of an input .txt file? [snip] Starting from FMPP 0.9.9 (or with the latest version in the CVS until 0.9.9 is released) it's possible with the new slicedText(fileName[, options]) data loader. This reads a text file as a sequence of strings. The separator is by default "\n", but it can be changed with the options. -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: Daniel D. <dd...@fr...> - 2005-02-25 01:44:51
|
Thursday, February 24, 2005, 10:24:19 PM, Ralf Hauser wrote:
> -----Original Message-----
> From: Ralf Hauser [mailto:ral...@gm...]
> Sent: Thursday, February 24, 2005 8:16 PM
> To: 'fmp...@li...'
> Subject: dynamic traversal of csv records
>
> How would I dynamically traverse through my csv data?
>
> Basically I want not to access the columns of the table by name, but by
> position. E.g. instead of
> <#list flowers as flower>
> <tr><td>${flower.name}...
> as in http://fmpp.sourceforge.net/dataloader.html#key_csv, I would want to
> just access
> <#list flowers as flower>
> <tr><td>${flower.1}...
> and "1" being column 1
>
> Also, I would need an inner loop if I not only don't want to use the column
> name to access the field values, but also don't know ahead of time how many
> columns there are.
You can use the "headers" sub-variable to dynamically query the number
of columns and the name of columns. OK, you don't have names... actually
it's a problem that annoys me for a while, since it's sometimes not easy
to ensure that the first row with header names exists... I will look
into this tomorrow. I hope...
> I see in
> http://freemarker.org/docs/ref_directive_list.html#ref.directive.list
> that there is "item_index" and "item_has_next" to handle dynamic length
> lists, i.e. the "vertical" of the table.
> I guess, I could convert the "flower" data structure into a sequence again,
> then, it would be possible to create an inner loop... and thus handle the
> "horizontal" of the table...
>
> Basically I want to create one cvs to sql-insert statement macro that I can
> use for any csv. I think it is not too hard to get the headers right with
> the
> <#list flowers.headers as h>
> approach, however, I would need a hint how to do the same on each row's
> content?
I don't understand... the columns are the same for each row, so it
doesn't make sense to get the headers for an individual row of a CVS
file. No?
--
Best regards,
Daniel Dekany
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
|
|
From: Ralf H. <ral...@gm...> - 2005-02-24 19:16:39
|
How would I dynamically traverse through my csv data?
Basically I want not to access the columns of the table by name, but by
position. E.g. instead of
<#list flowers as flower>
<tr><td>${flower.name}...
as in http://fmpp.sourceforge.net/dataloader.html#key_csv, I would want to
just access
<#list flowers as flower>
<tr><td>${flower.1}...
and "1" being column 1
Also, I would need an inner loop if I not only don't want to use the column
name to access the field values, but also don't know ahead of time how many
columns there are.
I see in
http://freemarker.org/docs/ref_directive_list.html#ref.directive.list
that there is "item_index" and "item_has_next" to handle dynamic length
lists, i.e. the "vertical" of the table.
I guess, I could convert the "flower" data structure into a sequence again,
then, it would be possible to create an inner loop... and thus handle the
"horizontal" of the table...
Basically I want to create one cvs to sql-insert statement macro that I can
use for any csv. I think it is not too hard to get the headers right with
the
<#list flowers.headers as h>
approach, however, I would need a hint how to do the same on each row's
content?
|
|
From: Ralf H. <ral...@gm...> - 2005-02-24 18:40:34
|
As per http://fmpp.sourceforge.net/dataloader.html#key_csv, it appears that only semicolon and tab are permitted. It would be great if it were also working with the comma (as in "C-S-V" ;) ) all my input data is such and I can't just simply change because there is some dependent escaping done etc. Best would even be if one could specify it right in the "separator" option and all values would be allowed (perhaps except "\n" since that is the record separator. Although if following the MySQL example one could even be flexible and add the optional option of a "lineSeparator") ? So, if I wanted my dataloader to separate with &&, I'd just write csv(data/foo.txt, {separator: "&&"}) ? What do you think? |
|
From: Daniel D. <dd...@fr...> - 2005-02-24 11:49:43
|
Thursday, February 24, 2005, 7:26:19 AM, Ralf Hauser wrote: > Hi, > > How can one easily iterate through lines of an input .txt file? > > I faintly remember that this is very easy with the Perl while loop, but I'd > rather stay with fmpp and I didn't find anything in freemarker doc. FreeMarker is not meant to be a full-blown programming language like Perl: the preparation of the data model should be done outside the template, that is, in this case by FMPP + a data loader. However, in fact, this can be done in pure FreeMarker, but that would be ugly and antipattern... > Plan: > ===== > I have a txt file with each line representing a relational table record. I > want to prefix some string (SQL instruction), perhaps replace some "," with > "','" and terminate each line by replacing "@@@" with a closing string. > And this needs to be written to a different outputfile (e.g. ".sql") > > If anyone can share an example how to do this, many thanks in advance! The "textSequence" data loader is something in my TODO list for a long time, and I will add it to the CVS tonight. That is similar to the "text" data loader, just it splits the text into a sequence of strings at a specified symbol, like for example line-break. > Ralf > > Ps: > > Background: > =========== > Basically, I need the opposite of what Carl has so nicely contributed > (Although I would call his oeuvre "SqlDataRetriever") and I would call what > I need SqlDataUploader. > ** > > He is retrieving data from sql into fmpp and I want to take data out of a > txt file into fmpp and ultimately into a relational DB. > > So far, my input txt file was sufficient with MySQL and I used > LOAD DATA > INFILE './tbl_globals.txt' > INTO TABLE TBL_GLOBALS > FIELDS TERMINATED BY ',' > LINES TERMINATED BY '@@@'; > > Now, the data also needs to go into Oracle and I am told, it is for the few > dozens of records easier to just do plain SQL insert statements with the > values than to try to create a "sqlldr" .ctl input file. This is what I want > to achieve above. > > The advantage of going for plain SQL is furthermore that it will be more > portable if I next had to get it into DB2, Postgres, Daffodil, ... > > > -------------- > Securely and spam-free via: > https://www.privasphere.com/e.do?ema...@ac... > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > fmpp-open mailing list > fmp...@li... > https://lists.sourceforge.net/lists/listinfo/fmpp-open -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: Ralf H. <ral...@gm...> - 2005-02-24 06:26:57
|
Hi,
How can one easily iterate through lines of an input .txt file?
I faintly remember that this is very easy with the Perl while loop, but I'd
rather stay with fmpp and I didn't find anything in freemarker doc.
Plan:
=====
I have a txt file with each line representing a relational table record. I
want to prefix some string (SQL instruction), perhaps replace some "," with
"','" and terminate each line by replacing "@@@" with a closing string.
And this needs to be written to a different outputfile (e.g. ".sql")
If anyone can share an example how to do this, many thanks in advance!
Ralf
Ps:
Background:
===========
Basically, I need the opposite of what Carl has so nicely contributed
(Although I would call his oeuvre "SqlDataRetriever") and I would call what
I need SqlDataUploader.
**
He is retrieving data from sql into fmpp and I want to take data out of a
txt file into fmpp and ultimately into a relational DB.
So far, my input txt file was sufficient with MySQL and I used
LOAD DATA
INFILE './tbl_globals.txt'
INTO TABLE TBL_GLOBALS
FIELDS TERMINATED BY ','
LINES TERMINATED BY '@@@';
Now, the data also needs to go into Oracle and I am told, it is for the few
dozens of records easier to just do plain SQL insert statements with the
values than to try to create a "sqlldr" .ctl input file. This is what I want
to achieve above.
The advantage of going for plain SQL is furthermore that it will be more
portable if I next had to get it into DB2, Postgres, Daffodil, ...
--------------
Securely and spam-free via:
https://www.privasphere.com/e.do?ema...@ac...
|
|
From: Daniel D. <dd...@fr...> - 2005-01-28 20:47:09
|
FMPP 0.9.8 is released. Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.8.tar.gz New features, improvements: * FreeMarker 2.3.2mod (a stable nightly build after 2.3.2) is included. * FMPP was updated to enable the new output encoding and URL escaping related features of FreeMarker 2.3.1. (The usage of 2.3.2mod is recommended because of a bugfix.) * New setting: urlEscapingCharset * Java API: added static final fields to Engine for reserved engine parameter (setting) value strings: PARAMETER_VALUE_SOURCE, PARAMETER_VALUE_HOST, PARAMETER_VALUE_OUTPUT. Also added the similar missing static fields to the Settings class. Bugfixes: * The reserved "host" output encoding value was not resolved in some rare cases. * The pp.urlEnc/pp.urlPathEnc functions and the fmpp.util.StringUtil.urlEnc(...)/urlPathEnc(...) methods were malfunctioned with a few charsets, for example with UTF-16, UTF-7, and EBCDIC based charsets. * Warning! Incompatible Java API change! The documentation of fmpp.ProgressListener.notifyProgressEvent(...) forgot to mention regarding the event parameter that: "As new event types can be introduced with new FMPP versions (even if it happens very seldom), a progress listener implementation should survive events that it does not understand. That is, it must not stop with an error, but it should silently ignore the event." Note that there is no new event type in this version. * Many fixes in the Manual and in the the API JavaDocs. * Warning! Incompatible Java API change! The fmpp.util.NullWriter and fmpp.util.NullOutputStream classes has no public constructor anymore. Use their static INSTANCE field to get the singleton. * Fixed test-suite bugs: Windows vs UN*X vs Mac line-breaks, class-path problem in the build.xml. -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: Carl <mul...@al...> - 2005-01-24 09:14:36
|
Hello,
Please find as attachement a very simple SqlDataLoader. All the
configuration still need to be written. I've used it for a simple use,
by hardcoding the config data (hugly, but I was in hury).
If it can benefit for anyone, and if somebody feel to write the
configuration code, it would be nice ;-)
This code is totaly free of any right, you could use it as you want.
To use it, you just need to write
<#assign database = pp.loadData('SqlDataLoader') >
and then,
${database.tableName} is a list with all rows of table "tableName"
so you could write :
<#list database.tableName as row>
${row.fieldName}
</#list>
to retrieve your data.
Carl
|
|
From: Daniel D. <dd...@fr...> - 2004-11-03 20:24:14
|
Wednesday, November 3, 2004, 7:29:25 PM, Erich Oliphant wrote: > At this point just detecting the fact that a file was infact changed > (had interpolations) would be sufficient. At install time, I just want > to save off originals that have interpolations so that an install set > can be updated if there are parameter/variable changes. The actual > variable is a nice to have but not necessary now. With the exception of > this issue FMPP seems to meet all of my other requirements. If you > could point me in the right direction, I'd be more than happy to work on > a hack and send it back to you so that you can decide whether or not to > include it in your next version. I believe the place to start is Template.getRootTreeNode(). AFAIK this provides access to the "abstract syntax tree" of the template. By traversing that tree you can find out if what directives it uses, and it it uses interpolations. I don't know that API, but you may look into the FreeMarker sourcecode or ask about it on the FreeMarker developer list if you stuck with it. (Also, the FreeMarker Eclipse pluging can visualize the template tree based on this, so you may look into that...) Now, about the FMPP integration... For obvious reasons it is not possible in general to find out based on this if a template actually contains dynamism, however for a particular application it may works. Also, this feature is special enough. So I don't think it will be out-of-the-box feature, but a "hook" can be added where you can plug whatever custom Template investigation via a custom class. So this could be an option like --before-template-execution=<className>. This hook class should examine the Template object, and send feedback to the embedding software (the installer system in your case) inform it: "Hey, the X file contains interpolations.". The consumer of these feedback messages may be made accessible with an Engine attribute (see in the JavaDocs) for the hook object. Then... I don't think you should invest too much into the FMPP part. On the 11th November I have a deadline, and then certainly I will be free for a while. I will have to do some higher priority OS tasks first, but I guess I will start to work on the next FMPP release soon after the deadline... so you may survive with whatever ugly (non-generalized) hack until that. -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: Erich O. <er...@va...> - 2004-11-03 18:28:59
|
At this point just detecting the fact that a file was infact changed
(had interpolations) would be sufficient. At install time, I just want
to save off originals that have interpolations so that an install set
can be updated if there are parameter/variable changes. The actual
variable is a nice to have but not necessary now. With the exception of
this issue FMPP seems to meet all of my other requirements. If you
could point me in the right direction, I'd be more than happy to work on
a hack and send it back to you so that you can decide whether or not to
include it in your next version.
Daniel Dekany wrote:
>Thursday, October 28, 2004, 9:56:39 PM, Erich Oliphant wrote:
>
>
>
>>Hmm,
>>Yeah, I looked at the Freemarker Template class, nothing there to go
>>on. Is there somewhere in FMPP that we could perhaps compare the src
>>to the destination file?
>>
>>
>
>Do you want to detect if a variable is actually accessed during template
>execution, or simply you want to know if a file contains any
>interpolations (${...})? The latest can be find out from the Template
>object (it has an undocumented API for traversing the syntax tree).
>However, FMPP has no built-in hook that you could utilize. But of course
>it's open source so you can hack it... And, in mid november I hope to
>really finish something that I have to do nowadays, and then I will have
>time to continue my opens source activities, but until that do not
>expect any new FMPP features from me... in November we will see what
>features will be added, etc.
>
>
>
>>Daniel Dekany wrote:
>>
>>
>>
>>>Thursday, October 28, 2004, 7:33:48 PM, Erich Oliphant wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>I am using FMPP as the basis of an installer for our system. I was
>>>>wondering if there's a way to find out (maybe via a callback?) which
>>>>files FreeMarker/FMPP actually performed replacements in, and as a bonus
>>>>which variables were replaced.
>>>>
>>>>
>>>>
>>>>
>>>No way... (At least yet...)
>>>
>>>
>
>
>____________________________________________________________________
>Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
>Probald ki most! http://www.freestart.hu
>
>
>-------------------------------------------------------
>This Newsletter Sponsored by: Macrovision
>For reliable Linux application installations, use the industry's leading
>setup authoring tool, InstallShield X. Learn more and evaluate
>today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
>_______________________________________________
>fmpp-open mailing list
>fmp...@li...
>https://lists.sourceforge.net/lists/listinfo/fmpp-open
>
>
>
>
|
|
From: Daniel D. <dd...@fr...> - 2004-10-28 21:24:13
|
Thursday, October 28, 2004, 9:56:39 PM, Erich Oliphant wrote:
> Hmm,
> Yeah, I looked at the Freemarker Template class, nothing there to go
> on. Is there somewhere in FMPP that we could perhaps compare the src
> to the destination file?
Do you want to detect if a variable is actually accessed during template
execution, or simply you want to know if a file contains any
interpolations (${...})? The latest can be find out from the Template
object (it has an undocumented API for traversing the syntax tree).
However, FMPP has no built-in hook that you could utilize. But of course
it's open source so you can hack it... And, in mid november I hope to
really finish something that I have to do nowadays, and then I will have
time to continue my opens source activities, but until that do not
expect any new FMPP features from me... in November we will see what
features will be added, etc.
> Daniel Dekany wrote:
>
>>Thursday, October 28, 2004, 7:33:48 PM, Erich Oliphant wrote:
>>
>>
>>
>>>Hi,
>>>I am using FMPP as the basis of an installer for our system. I was
>>>wondering if there's a way to find out (maybe via a callback?) which
>>>files FreeMarker/FMPP actually performed replacements in, and as a bonus
>>>which variables were replaced.
>>>
>>>
>>
>>No way... (At least yet...)
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
|
|
From: Erich O. <er...@va...> - 2004-10-28 19:56:19
|
Hmm, Yeah, I looked at the Freemarker Template class, nothing there to go on. Is there somewhere in FMPP that we could perhaps compare the src to the destination file? Daniel Dekany wrote: >Thursday, October 28, 2004, 7:33:48 PM, Erich Oliphant wrote: > > > >>Hi, >>I am using FMPP as the basis of an installer for our system. I was >>wondering if there's a way to find out (maybe via a callback?) which >>files FreeMarker/FMPP actually performed replacements in, and as a bonus >>which variables were replaced. >> >> > >No way... (At least yet...) > > > >>Thanks >> >> > > > |
|
From: Daniel D. <dd...@fr...> - 2004-10-28 17:53:44
|
Thursday, October 28, 2004, 7:33:48 PM, Erich Oliphant wrote: > Hi, > I am using FMPP as the basis of an installer for our system. I was > wondering if there's a way to find out (maybe via a callback?) which > files FreeMarker/FMPP actually performed replacements in, and as a bonus > which variables were replaced. No way... (At least yet...) > Thanks -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: Erich O. <er...@va...> - 2004-10-28 17:33:28
|
Hi, I am using FMPP as the basis of an installer for our system. I was wondering if there's a way to find out (maybe via a callback?) which files FreeMarker/FMPP actually performed replacements in, and as a bonus which variables were replaced. Thanks |
|
From: Erich O. <er...@va...> - 2004-10-12 15:45:21
|
Daniel Dekany wrote:
>Friday, October 8, 2004, 8:18:14 PM, Erich Oliphant wrote:
>
>
>
>>Daniel Dekany wrote:
>>
>>
>>
>>>Friday, October 8, 2004, 4:31:16 PM, Erich Oliphant wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>I am using FMPP w/ Ant to create a installer for our application.
>>>>Working pretty good so far but have a couple issues:
>>>>
>>>>1) We've using the ant XMLProperty to create Ant properties based on XML
>>>>config files. This is great for us, as we have lots of config items and
>>>>grouping them hierarchically is convienient. The problem, of course, is
>>>>that ant properties of the form 'parent.property' are a problem for
>>>>FMPP/Freemarker since ${parent.property} tries to resolve 'parent' then
>>>>'property' as a child. I read the FM docs regarding the
>>>>${.vars["parent.property"]} syntax to get around the problem. That
>>>>works but is syntactically clunky. Is there a cleaner way to do this?
>>>>
>>>>
>>>>
>>>>
>>>No... This is actually a FreeMarker syntax issue, although I don't blame
>>>FreeMarker for this.
>>>
>>>
>>>
>>Yeah understand it's not necessarily a bad thing from an FM point of
>>view. Just like item 2, it's really only an issue when you are trying to
>>do generic text proc'ing on top of it ;)
>>
>>
>
>Whatever expression language you chose, there is a high chance that it
>will clash with something... OK, maybe if FreeMarker uses an extreme
>separator character for separating variables from subvariables, say, ~
>(foo~bar), there is far less chance for clashes, but using such extreme
>syntax would drive most users crazy... :) Actually, in XML related
>languages the usual subvariable separator is /, which is used as
>division operator in most other languages. Maybe that's a good choice
>for template languages? I don't know...
>
>
>
>>>>2) Some of the files that we are configuring are Unix shell scripts. In
>>>>some cases the ${SHELL_VAR} form for shell variables is used, and the
>>>>FMPP processing throws an error when it hits one of these as they are
>>>>not defined. This becomes a tricky problem as it's nice to know from an
>>>>FMPP perspective that I've hit an undefined variable reference, but in
>>>>this case I'd like to maybe log, the undefined var and keep processing.
>>>>Or is there some way to define an alternate variable resolution syntax
>>>>for FMPP/Freemarker? This is a Java web application were building so we
>>>>are going to run into the same problem with Java Expression Language
>>>>variables that use the ${} form as well.
>>>>
>>>>
>>>>
>>>That's an issue with FreeMarker (again), namely that it doesn't allow
>>>the configuration of its syntax. I know this is a real problem for
>>>general purpose file preprocessors, because so many other formats use
>>>${exp}... Currently you can write ${'$'}{SHELL_VAR}, which is obviously
>>>terrible if you have to do it frequently. A workaround would be to
>>>replace all @{...}-s with ${...}, and all ${...} with ${'$'}{...} when
>>>FMPP loads the template files, thus simulate that the FreeMarker
>>>interpolation syntax is @{exp}. That slows things down a little bit,
>>>also possibly distorts the column number in error messages, but I guess
>>>that would be better than nothing. What do you think?
>>>
>>>
>>>
>>Sounds good to me :) You have any sample code/expressions that would
>>illustrate this?
>>
>>
>
>No, it's just and idea, that can be implemented (by me, mostly). Since
>then I have realized that it has a little problem: FreeMarker has
>built-ins for evaluating FTL expressions/fragments that are given with a
>(possibly dynamically calculated) string value... in those the
>interpolations would still use ${...} syntax. Well, the replacement
>thing is a dirty hack, and the result is dirty as well.
>
I think that for now I am just gonna <noparse> the shell vars. Done it
so far and it's not that onerous.
>
>
>
|
|
From: Daniel D. <dd...@fr...> - 2004-10-08 19:58:11
|
Friday, October 8, 2004, 8:18:14 PM, Erich Oliphant wrote:
> Daniel Dekany wrote:
>
>>Friday, October 8, 2004, 4:31:16 PM, Erich Oliphant wrote:
>>
>>
>>
>>>Hi,
>>>I am using FMPP w/ Ant to create a installer for our application.
>>>Working pretty good so far but have a couple issues:
>>>
>>>1) We've using the ant XMLProperty to create Ant properties based on XML
>>>config files. This is great for us, as we have lots of config items and
>>>grouping them hierarchically is convienient. The problem, of course, is
>>>that ant properties of the form 'parent.property' are a problem for
>>>FMPP/Freemarker since ${parent.property} tries to resolve 'parent' then
>>>'property' as a child. I read the FM docs regarding the
>>>${.vars["parent.property"]} syntax to get around the problem. That
>>>works but is syntactically clunky. Is there a cleaner way to do this?
>>>
>>>
>>
>>No... This is actually a FreeMarker syntax issue, although I don't blame
>>FreeMarker for this.
>>
> Yeah understand it's not necessarily a bad thing from an FM point of
> view. Just like item 2, it's really only an issue when you are trying to
> do generic text proc'ing on top of it ;)
Whatever expression language you chose, there is a high chance that it
will clash with something... OK, maybe if FreeMarker uses an extreme
separator character for separating variables from subvariables, say, ~
(foo~bar), there is far less chance for clashes, but using such extreme
syntax would drive most users crazy... :) Actually, in XML related
languages the usual subvariable separator is /, which is used as
division operator in most other languages. Maybe that's a good choice
for template languages? I don't know...
>>>2) Some of the files that we are configuring are Unix shell scripts. In
>>>some cases the ${SHELL_VAR} form for shell variables is used, and the
>>>FMPP processing throws an error when it hits one of these as they are
>>>not defined. This becomes a tricky problem as it's nice to know from an
>>>FMPP perspective that I've hit an undefined variable reference, but in
>>>this case I'd like to maybe log, the undefined var and keep processing.
>>>Or is there some way to define an alternate variable resolution syntax
>>>for FMPP/Freemarker? This is a Java web application were building so we
>>>are going to run into the same problem with Java Expression Language
>>>variables that use the ${} form as well.
>>>
>>That's an issue with FreeMarker (again), namely that it doesn't allow
>>the configuration of its syntax. I know this is a real problem for
>>general purpose file preprocessors, because so many other formats use
>>${exp}... Currently you can write ${'$'}{SHELL_VAR}, which is obviously
>>terrible if you have to do it frequently. A workaround would be to
>>replace all @{...}-s with ${...}, and all ${...} with ${'$'}{...} when
>>FMPP loads the template files, thus simulate that the FreeMarker
>>interpolation syntax is @{exp}. That slows things down a little bit,
>>also possibly distorts the column number in error messages, but I guess
>>that would be better than nothing. What do you think?
>>
> Sounds good to me :) You have any sample code/expressions that would
> illustrate this?
No, it's just and idea, that can be implemented (by me, mostly). Since
then I have realized that it has a little problem: FreeMarker has
built-ins for evaluating FTL expressions/fragments that are given with a
(possibly dynamically calculated) string value... in those the
interpolations would still use ${...} syntax. Well, the replacement
thing is a dirty hack, and the result is dirty as well.
--
Best regards,
Daniel Dekany
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
|
|
From: Erich O. <er...@va...> - 2004-10-08 18:18:23
|
Daniel Dekany wrote:
>Friday, October 8, 2004, 4:31:16 PM, Erich Oliphant wrote:
>
>
>
>>Hi,
>>I am using FMPP w/ Ant to create a installer for our application.
>>Working pretty good so far but have a couple issues:
>>
>>1) We've using the ant XMLProperty to create Ant properties based on XML
>>config files. This is great for us, as we have lots of config items and
>>grouping them hierarchically is convienient. The problem, of course, is
>>that ant properties of the form 'parent.property' are a problem for
>>FMPP/Freemarker since ${parent.property} tries to resolve 'parent' then
>>'property' as a child. I read the FM docs regarding the
>>${.vars["parent.property"]} syntax to get around the problem. That
>>works but is syntactically clunky. Is there a cleaner way to do this?
>>
>>
>
>No... This is actually a FreeMarker syntax issue, although I don't blame
>FreeMarker for this.
>
Yeah understand it's not necessarily a bad thing from an FM point of
view. Just like item 2, it's really only an issue when you are trying to
do generic text proc'ing on top of it ;)
>
>
>
>>2) Some of the files that we are configuring are Unix shell scripts. In
>>some cases the ${SHELL_VAR} form for shell variables is used, and the
>>FMPP processing throws an error when it hits one of these as they are
>>not defined. This becomes a tricky problem as it's nice to know from an
>>FMPP perspective that I've hit an undefined variable reference, but in
>>this case I'd like to maybe log, the undefined var and keep processing.
>>Or is there some way to define an alternate variable resolution syntax
>>for FMPP/Freemarker? This is a Java web application were building so we
>>are going to run into the same problem with Java Expression Language
>>variables that use the ${} form as well.
>>
>>
>
>That's an issue with FreeMarker (again), namely that it doesn't allow
>the configuration of its syntax. I know this is a real problem for
>general purpose file preprocessors, because so many other formats use
>${exp}... Currently you can write ${'$'}{SHELL_VAR}, which is obviously
>terrible if you have to do it frequently. A workaround would be to
>replace all @{...}-s with ${...}, and all ${...} with ${'$'}{...} when
>FMPP loads the template files, thus simulate that the FreeMarker
>interpolation syntax is @{exp}. That slows things down a little bit,
>also possibly distorts the column number in error messages, but I guess
>that would be better than nothing. What do you think?
>
Sounds good to me :) You have any sample code/expressions that would
illustrate this ?
>
>
>
|
|
From: Daniel D. <dd...@fr...> - 2004-10-08 16:40:22
|
Friday, October 8, 2004, 4:31:16 PM, Erich Oliphant wrote:
> Hi,
> I am using FMPP w/ Ant to create a installer for our application.
> Working pretty good so far but have a couple issues:
>
> 1) We've using the ant XMLProperty to create Ant properties based on XML
> config files. This is great for us, as we have lots of config items and
> grouping them hierarchically is convienient. The problem, of course, is
> that ant properties of the form 'parent.property' are a problem for
> FMPP/Freemarker since ${parent.property} tries to resolve 'parent' then
> 'property' as a child. I read the FM docs regarding the
> ${.vars["parent.property"]} syntax to get around the problem. That
> works but is syntactically clunky. Is there a cleaner way to do this?
No... This is actually a FreeMarker syntax issue, although I don't blame
FreeMarker for this.
> 2) Some of the files that we are configuring are Unix shell scripts. In
> some cases the ${SHELL_VAR} form for shell variables is used, and the
> FMPP processing throws an error when it hits one of these as they are
> not defined. This becomes a tricky problem as it's nice to know from an
> FMPP perspective that I've hit an undefined variable reference, but in
> this case I'd like to maybe log, the undefined var and keep processing.
> Or is there some way to define an alternate variable resolution syntax
> for FMPP/Freemarker? This is a Java web application were building so we
> are going to run into the same problem with Java Expression Language
> variables that use the ${} form as well.
That's an issue with FreeMarker (again), namely that it doesn't allow
the configuration of its syntax. I know this is a real problem for
general purpose file preprocessors, because so many other formats use
${exp}... Currently you can write ${'$'}{SHELL_VAR}, which is obviously
terrible if you have to do it frequently. A workaround would be to
replace all @{...}-s with ${...}, and all ${...} with ${'$'}{...} when
FMPP loads the template files, thus simulate that the FreeMarker
interpolation syntax is @{exp}. That slows things down a little bit,
also possibly distorts the column number in error messages, but I guess
that would be better than nothing. What do you think?
--
Best regards,
Daniel Dekany
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
|
|
From: Erich O. <er...@va...> - 2004-10-08 14:31:18
|
Hi,
I am using FMPP w/ Ant to create a installer for our application.
Working pretty good so far but have a couple issues:
1) We've using the ant XMLProperty to create Ant properties based on XML
config files. This is great for us, as we have lots of config items and
grouping them hierarchically is convienient. The problem, of course, is
that ant properties of the form 'parent.property' are a problem for
FMPP/Freemarker since ${parent.property} tries to resolve 'parent' then
'property' as a child. I read the FM docs regarding the
${.vars["parent.property"]} syntax to get around the problem. That
works but is syntactically clunky. Is there a cleaner way to do this?
2) Some of the files that we are configuring are Unix shell scripts. In
some cases the ${SHELL_VAR} form for shell variables is used, and the
FMPP processing throws an error when it hits one of these as they are
not defined. This becomes a tricky problem as it's nice to know from an
FMPP perspective that I've hit an undefined variable reference, but in
this case I'd like to maybe log, the undefined var and keep processing.
Or is there some way to define an alternate variable resolution syntax
for FMPP/Freemarker? This is a Java web application were building so we
are going to run into the same problem with Java Expression Language
variables that use the ${} form as well.
|
|
From: Daniel D. <dd...@fr...> - 2004-09-21 12:29:40
|
Tuesday, September 21, 2004, 10:36:20 AM, Tomáš Páral wrote: > Hello, > > I am new in FMPP, but I am able to make easy or intermediate web > project by FMPP, but I don't know, how build a sophisticated web with > complex navigation, sitemap, sections and multilingual. What you should decide is if what approach do you need for your site. I think that it is a good idea to start with finding out what data sources do you want to use to generate the site. Where does the content come from, how is that data structured, how does it describe the content, what properties of the content does it describe? Where does the visual design come? Forget about FMPP or any other tools when you think about this. If you already see what input do you want to use, and what people will work on the project (i.e. what can you expect from then professionally), only then start to to think about the tools you want to use to create output from that. Maybe you will find that FMPP is a good tool for your task, but maybe you will chose Apache Forest... etc. maybe you will find that the tool that suits you needs doesn't exist, and you begin to change your needs :)... So the point is that these are just tools. For example, if you have a site with big, complex, but well structured content and strictly uniform look (i.e. most of the pages use exactly the same visual design), then maybe it is a good idea to generated it from a data source that purely concentrates on the semantic of the content. For example, look at the FreeMarker Manual. It has several pages, ToC-s, index, paging, etc. To generate such things automatically, the program that generates the HTML pages must understand the structure of the document (what chapters do we have, etc.). So the HTML generator doesn't see the site as a heap of almost-HTML pages (which is the basic FMPP approach, however, because of the XML rendering feature it is not the only one), but as an output format independent document, content with semantic. In the case of the FreeMarker documentation, the data source is a single DocBook XML document, that defines chapters, paragraphs, etc, pure semantic, no visual aspects, not even pages. Then it is transformed to HTML pages using a Java program and FreeMarker templates, that will generate the ToC, the navigation buttons, etc. (It doesn't use FMPP). > I know, that I am ambitious, thus I need some example. Does somebody > have at disposal some project of sophisticated web and he is willing > to send him to me? > > I am sorry about my english Me too about mine... :) -- Best regards, Daniel Dekany ____________________________________________________________________ Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol. Probald ki most! http://www.freestart.hu |
|
From: <pa...@se...> - 2004-09-21 08:36:41
|
Hello, I am new in FMPP, but I am able to make easy or intermediate web project by FMPP, but I don't know, how build a sophisticated web with complex navigation, sitemap, sections and multilingual. I know, that I am ambitious, thus I need some example. Does somebody have at disposal some project of sophisticated web and he is willing to send him to me? I am sorry about my english regards tomas |
|
From: Asad N. <noo...@ho...> - 2004-06-17 07:25:15
|
Thankyou very much once again for your help.
You are very right, i was trying to save hash values in the sequence because
thats the requirement for the project that the hierarchy of the structure be
kept like this.
Now i understood the concept of the "index" parameter in the @pp.add from
the example you gave. I have read the documents quite intensively already
and i am really sorry as the lack of examples sometimes really confuse me.
But now when i read the explanation again after this email, i feel that it
didnt need an example to explain, i should have understood it in the first
place.
Btw i am a pakistani student and am doing my masters here in germany
currently.
thanks once again for your help.
Best Regards
Asadullah Khan Niazi
>Today's Topics:
>
> 1. help required regarding saving values in a sequence during a loop
>(Asad Niazi)
> 2. Re: help required regarding saving values in a sequence during a
>loop (Daniel Dekany)
>
>--__--__--
>
>Message: 1
>From: "Asad Niazi" <noo...@ho...>
>To: fmp...@li...
>Date: Wed, 16 Jun 2004 14:52:36 +0500
>Subject: [FMPP] help required regarding saving values in a sequence during
>a loop
>Reply-To: fmp...@li...
>
>Hello!
>I have a problem regarding saving values in a sequence (using the add/set
>fmpp pphash) during a loop (inside the <#list> ). I intended to increase
>the
>index by increasing the counter x e.g. index = x, where x is increasing in
>every run of the loop.
>
>The actual problem is that i dont understand the difference of "add" and
>"set" fmpp pphash when they are used to add values in a sequence. For your
>help let me outline what i am trying to do:
>e.g the Writable seqeunce will be NamedNumber
>it will have 2 subelements or "keys"; "Name" and "Number"
>they can store values for lot of "names" and "numbers" (which makes it a
>sequence)
>
>What I have currently done is that i have tried different combinations of
>"set" and "add" on this writable sequence.
>
><@pp.add seq=NamedNumber index=x value={"Name": whatevervalue} />
>
>should this work??
>
>or should i use??
>
><@pp.set seq=NamedNumber index=x key="Name" value=whatevervalue />
>
>somehow both of these are not working. As i told you before i am not very
>clear with the difference of set and add pphashes and the use of index
>parameter in them.
>I am desperately looking for help in this matter. I ll be looking forward
>to
>your reply. Thanking in anticipation.
>
>Best Regards
>Asadullah Khan Niazi
>
>_________________________________________________________________
>The new MSN 8: advanced junk mail protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>
>--__--__--
>
>Message: 2
>Date: Wed, 16 Jun 2004 18:12:02 +0200
>From: Daniel Dekany <dd...@fr...>
>To: Asad Niazi <fmp...@li...>
>Subject: Re: [FMPP] help required regarding saving values in a sequence
>during a loop
>Reply-To: fmp...@li...
>
>Wednesday, June 16, 2004, 11:52:36 AM, Asad Niazi wrote:
>
> > Hello!
> > I have a problem regarding saving values in a sequence (using the
>add/set
> > fmpp pphash) during a loop (inside the <#list> ). I intended to increase
>the
> > index by increasing the counter x e.g. index = x, where x is increasing
>in
> > every run of the loop.
> >
> > The actual problem is that i dont understand the difference of "add" and
> > "set" fmpp pphash when they are used to add values in a sequence.
>
>As the documentation says, "add" inserts a new item, while "set"
>replaces an already existing item at the specified index.
>
> > For your help let me outline what i am trying to do: e.g the Writable
> > seqeunce will be NamedNumber it will have 2 subelements or "keys";
>
>Sequences has no "keys". Only hashes has keys. Sequences has indexes.
>
> > "Name" and "Number" they can store values for lot of "names" and
> > "numbers" (which makes it a sequence)
> >
> > What I have currently done is that i have tried different combinations
>of
> > "set" and "add" on this writable sequence.
> >
> > <@pp.add seq=NamedNumber index=x value={"Name": whatevervalue} />
> >
> > should this work??
>
>Yes... as far as the variable values are correct, i.e. x is an integer
>with correct value, etc.
>
> > or should i use??
> >
> > <@pp.set seq=NamedNumber index=x key="Name"
>value=whatevervalue />
>
>It's surely bad, as sequences has no keys.
>
> > somehow both of these are not working. As i told you before i am not
>very
> > clear with the difference of set and add pphashes and the use of index
> > parameter in them.
>
>It seems that the root of the problem that you don't understand what are
>sequences and what's a hashes. You may should read the FreeMarker Manual
>about this, if you didn't. Anyway... I try to explain it now. Both data
>structure is a collection. They store multiple values of *any* type.
>Now, to access (read/modify/delete/etc.) a value in a collection somehow
>you must use the unique address of the value (unique in the collection).
>In the case of hashes addresses are strings that are called keys. In the
>case of sequences addresses are integer numbers that are called indices.
>The indices has the restriction that they are continuos and always
>starting from 0, so for example if the sequence length is 4, then the
>available indexes are 0, 1, 2, 3 (so if you "pp.add" a value with index
>2, then the the size will grow to 5, and the index of the values after 2
>will increase by 1).
>
>Now, in your case you just want to address words (the names) with an
>integer index, so you don't need hashes at all (seems that you tried to
>build a sequence of hash values... you can, but I guess you don't need
>to). So what you want could work somehow like this:
>
> <#assign NamedNumber = pp.newWritableSequence()>
> <@pp.add seq=NamedNumber value="Foo" />
> <@pp.add seq=NamedNumber value="Bar" />
> <@pp.add seq=NamedNumber value="Baaz" />
> Now test it:
> <#list NamedNumber as n>
> - ${n}
> </#list>
> ${NamedNumber[1]}
>
>(See the @pp.add documentation about the meaning of missing "index"
>parameter.) And this outputs:
>
> Now test it:
> - Foo
> - Bar
> - Baaz
> Bar
>
>Of course, in the above template could be implemented without writable
>sequences as well:
>
> <#assign NamedNumber = ["Foo", "Bar", "Baaz"]>
>
> > I am desperately looking for help in this matter. I ll be looking
>forward to
> > your reply. Thanking in anticipation.
>
>Well, *if* you didn't do it so till now, use the FMPP and the FreeMarker
>Manual intensively... they are quite detailed, it's all described there.
>
> > Best Regards
> > Asadullah Khan Niazi
>
>BTW, which country?
>
>--
>Best regards,
> Daniel Dekany
>
>
>
>
>
>--__--__--
>
>_______________________________________________
>fmpp-open mailing list
>fmp...@li...
>https://lists.sourceforge.net/lists/listinfo/fmpp-open
>
>
>End of fmpp-open Digest
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail
|
|
From: Daniel D. <dd...@fr...> - 2004-06-16 16:17:41
|
Wednesday, June 16, 2004, 11:52:36 AM, Asad Niazi wrote:
> Hello!
> I have a problem regarding saving values in a sequence (using the add/set
> fmpp pphash) during a loop (inside the <#list> ). I intended to increase the
> index by increasing the counter x e.g. index = x, where x is increasing in
> every run of the loop.
>
> The actual problem is that i dont understand the difference of "add" and
> "set" fmpp pphash when they are used to add values in a sequence.
As the documentation says, "add" inserts a new item, while "set"
replaces an already existing item at the specified index.
> For your help let me outline what i am trying to do: e.g the Writable
> seqeunce will be NamedNumber it will have 2 subelements or "keys";
Sequences has no "keys". Only hashes has keys. Sequences has indexes.
> "Name" and "Number" they can store values for lot of "names" and
> "numbers" (which makes it a sequence)
>
> What I have currently done is that i have tried different combinations of
> "set" and "add" on this writable sequence.
>
> <@pp.add seq=NamedNumber index=x value={"Name": whatevervalue} />
>
> should this work??
Yes... as far as the variable values are correct, i.e. x is an integer
with correct value, etc.
> or should i use??
>
> <@pp.set seq=NamedNumber index=x key="Name" value=whatevervalue />
It's surely bad, as sequences has no keys.
> somehow both of these are not working. As i told you before i am not very
> clear with the difference of set and add pphashes and the use of index
> parameter in them.
It seems that the root of the problem that you don't understand what are
sequences and what's a hashes. You may should read the FreeMarker Manual
about this, if you didn't. Anyway... I try to explain it now. Both data
structure is a collection. They store multiple values of *any* type.
Now, to access (read/modify/delete/etc.) a value in a collection somehow
you must use the unique address of the value (unique in the collection).
In the case of hashes addresses are strings that are called keys. In the
case of sequences addresses are integer numbers that are called indices.
The indices has the restriction that they are continuos and always
starting from 0, so for example if the sequence length is 4, then the
available indexes are 0, 1, 2, 3 (so if you "pp.add" a value with index
2, then the the size will grow to 5, and the index of the values after 2
will increase by 1).
Now, in your case you just want to address words (the names) with an
integer index, so you don't need hashes at all (seems that you tried to
build a sequence of hash values... you can, but I guess you don't need
to). So what you want could work somehow like this:
<#assign NamedNumber = pp.newWritableSequence()>
<@pp.add seq=NamedNumber value="Foo" />
<@pp.add seq=NamedNumber value="Bar" />
<@pp.add seq=NamedNumber value="Baaz" />
Now test it:
<#list NamedNumber as n>
- ${n}
</#list>
${NamedNumber[1]}
(See the @pp.add documentation about the meaning of missing "index"
parameter.) And this outputs:
Now test it:
- Foo
- Bar
- Baaz
Bar
Of course, in the above template could be implemented without writable
sequences as well:
<#assign NamedNumber = ["Foo", "Bar", "Baaz"]>
> I am desperately looking for help in this matter. I ll be looking forward to
> your reply. Thanking in anticipation.
Well, *if* you didn't do it so till now, use the FMPP and the FreeMarker
Manual intensively... they are quite detailed, it's all described there.
> Best Regards
> Asadullah Khan Niazi
BTW, which country?
--
Best regards,
Daniel Dekany
|
|
From: Asad N. <noo...@ho...> - 2004-06-16 09:52:45
|
Hello!
I have a problem regarding saving values in a sequence (using the add/set
fmpp pphash) during a loop (inside the <#list> ). I intended to increase the
index by increasing the counter x e.g. index = x, where x is increasing in
every run of the loop.
The actual problem is that i dont understand the difference of "add" and
"set" fmpp pphash when they are used to add values in a sequence. For your
help let me outline what i am trying to do:
e.g the Writable seqeunce will be NamedNumber
it will have 2 subelements or "keys"; "Name" and "Number"
they can store values for lot of "names" and "numbers" (which makes it a
sequence)
What I have currently done is that i have tried different combinations of
"set" and "add" on this writable sequence.
<@pp.add seq=NamedNumber index=x value={"Name": whatevervalue} />
should this work??
or should i use??
<@pp.set seq=NamedNumber index=x key="Name" value=whatevervalue />
somehow both of these are not working. As i told you before i am not very
clear with the difference of set and add pphashes and the use of index
parameter in them.
I am desperately looking for help in this matter. I ll be looking forward to
your reply. Thanking in anticipation.
Best Regards
Asadullah Khan Niazi
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
|