[Typo3-dev] ObTS (was: TYPO3 "extendability" - BE - templates)
dan frost
dan at danfrost.co.uk
Sat Jun 12 21:16:39 CEST 2004
Zorik Pavlenko wrote:
> Well, I looked at the pdf a bit.
> It is used to create custom datatypes (like IMAGE, TEXT, etc.) ? Did I get
> it right?
>
> I have a question.
>
> Is there an existing way to do the following:
>
> BackUp.1 {
> command = tar ###options### ###destfile### ###sourcefiles###;
> options = -zxvf
> destfile = /home/www/bla/backup/bak.tar.gz
> sourcefiles.1 = /home/www/bla/filemounts
> sourcefiles.2 = /home/www/bla/typo3conf
> }
>
> where "options", "destfile", "sourcefiles.1" and "sourcefiles.2" are markers
> in "command" that will be replaced with the values.
>
No - but there could be. Making a "command" datatype which was designed
for this sort of thing is probably the best way.
> The point is to create them "on the fly" - the markers does not exist (are
> not hardcoded) in processing script. So that they may be anything and in any
> quantity.
>
> The same processing script should be able to process the following too:
>
> BackUp.1 {
> command = mv ###file1### ###file2###;
> file1 = /home/www/bla/backup/bak.tar.gz
> file2 = /home/www/bla/otherbackup/bak.tar.gz
> }
>
Hmmm...
Well, first you've got the "function" command. This is a function
because it does something. We need to add this to thye core functions
(in obtsfunc_pre, i'd say).
The function can cope with the mapping of the other attributes (options,
destfile...) by doing simple str_replace - or a regular expression which
is what i prefer.
The only remaining issues are the sourcefiles array and the output. The
output - what goes to the screen - depends on what you want it to do. Do
you want to "see" the result, download it, have a link to it...?
The sourcefiles array can be dealt with by a new function which i'll
call (for this example) .csv - that is, comma separated values.
.csv should have syntax:
Myexample = OBTS_TEXT
Myexample.csv = true
Myexample.1 = my first value
Myexample.2 = my second value
...
Myexample.n = my nth value
The csv function just makes the "value" of myexample equal to the CSV of
the integer children (1, 2, ... n). Best to make this a function rather
than a datatype because it isn't really adding a new kind of data but is
adding a new kind of processing/functionality.
I'll have a think about it, try some things and get back to you.
Dan
More information about the TYPO3-dev
mailing list