The two versions of Yeast engine

The Yeast template engine performs the processing of the template in the client’s browser using the JavaScript DOM API. Some old browsers do not support that API. Moreover, depending on the template size, and above all on the browser brand, the processing speed of Yeast may be low. It is faster to write the values directly in the document using document.write() than to resort to the DOM API.

<p>My name is <script>document.write(name)</script> I work at <script>document.write('<A href="'+link+'">'+link_txt+'</A>')</script></p>

This way of template design has obvious disadvantages, making the designer work tedious. This kind of templates suffer from irreparable flaws, such as being non-previewable and error prone. Therefore we are facing a dilemma: for the user, a quicker and supported by more browsers way of processing, but that, in turn, it is a tedious, non-previewable and error prone way of working for graphical designers.

Yeast templates provides you with the best of both worlds. Designers can keep working in "DOM mode", using Yeast attributes, but, once its design is finished and tested, they can translate the produced templates into the other version, which we will call "textual mode". The translation can be initiated by the designer, or automatically and transparently when using Yeast-Server.

Template translation

Yeast Server API provides a translation facility (read more). The following template element:

<tr yst="apply" ystSet="pfcs"> <td>$e.titulo$</td> </tr>

will be transformed into the following script:

<script> document.write(YST.Txt.apply(new Array(), 0, new Object(), 'pfcs', ['<tr><td>$e.titulo$</td></tr>'])) </script>