[TYPO3] Replace code in template

Xavier Perseguers typo3 at perseguers.ch
Tue Aug 26 22:41:11 CEST 2008


Hi,

> By HTML code you can imagine everything in the template file, doesn't 
> matter if it is in head or body part, examples:
> 
> 1. ...function changeImagesArray(array) {input.data_/...
> 2. ...newImage('input.data_/input_27-over.gif');...
> 3. ...<td rowspan="5"><img src="input.data_/input_05.gif"...
> 4. ...<a onmousedown="changeImages('input_15',..., etc.
> 
> "Replace" means that some strings (characters) from template file, e.g. 
> "input.data_" must to change to other strings (characters), e.g. 
> "output.data_" in whole template. In javascript functions and also in 
> <img> and <a> tags. It would be good, if it will be done by some simple 
> TypoScript code.
> 
> Automaketemplate extention for this purpose has build in function, i.e.
> elements.HEAD.str_replace.10 {
>        value = 'input.data_
>        replaceWith = 'output.data_
>     }
> which replace all occurancies of string "'input.data_" by string 
> "'output.data_", everywhere in the template file header part (similar 
> for body part). I want something similar also for Templavoila...
> 
> One possible usage of this procedure is, that when the template is 
> designed, it's not clear how the filenames will be called, only finally, 
> when the template for the site is completed, the right filenames are 
> included.

I never had such case. I think when the template is designed, the 
filenames are known because you want to be able to "test" the template 
without instantiating it in TYPO3. This is the purpose of TemplaVoilà 
which allows you to let a designer prepare a template that works (with 
valid filenames and so on) and lets you easily use it into a TYPO3 website.

But anyway...

I think you will have to map those stuff just as any other block of 
content, as a TypoScript object and then generate *the whole block* 
again in pure TypoScript.

I don't think it's possible to play with parseFunc without hooking into 
TemplaVoilà as TemplaVoilà parses the template itself.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-english mailing list