[TYPO3-50-general] [TYPO3-team-core-v5] Templating Engine

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Oct 22 12:50:29 CEST 2008


Karsten Dambekalns wrote: on 22.10.2008 12:15:

> Ernesto Baschny [cron IT] wrote:
>> You say: "Your template does not have to be in XML, but the templating
>> tags have to be nested and closed correctly.". - But why would we allow
>> non-XML templates? That just brings us to the pre-validation age!
>> Writing correct XML is so easy! So many tools available nowadays to work
>> with such files. That would be a big mistake not to keep on that route.
> 
> Just one point: because sometimes you need to create non-XML text output
> with a template. Having to write XML then feels strange.

I don't think that this is a problem. Having the tags being replaced by
its "content", we can have a template consisting of just <f3:..> tags,
so you end up with a "pure text", while the template itself is still XML
valid.

For example to generate a csv output of all blog posts:

<f3:template>
Title,Poster Name,Poster E-Mail
<f3:for each="{blogPosts}" as="post">
{post.title},{post.posterName},{post.posterEmail}</f3:for>
</f3:template>

That still is XML, but output is not. Maybe some <f3> attibutues to
strip (or add) new lines could help to get the output straight without
having to make the XML look ugly.

<f3:template f3:stripWhitespaces="true">
	Title,Poster Name,Poster E-Mail
	<f3:for each="{blogPosts}" as="post">
		{post.title},{post.posterName},{post.posterEmail}
	</f3:for>
</f3:template>

stripWhitespaces should strip leading and ending whitespaces, and remove
linefeeds before or after tags.

And also some method to get &lt; converted to "<", so that we could even
generate "non-XML" HTML 3.2, something like:

<f3:for each="{blogPosts}" as="post" f3:xmlEntitiesReplace="true">
	&lt;h1&gt;{post.title}
	&lt;p&gt;{post.posterName}
	&lt;p&gt;{post.posterEmail}
</f3:for>

Still XML, output is HTML 3.2.

Cheers,
Ernesto


More information about the TYPO3-project-5_0-general mailing list