views:

59

answers:

0

Is it possible to make next using freemarker?

e.g. in template i specify some values (i hope my syntax isn't misleading):

<td>${{<img src="[1234:thumb]" /><img src="[3456:thumb]" />}?{images are missing}}</td>

Idea is that, if application can make value, then new value used in template, if can't - default value is used. Main point is that i need values ("1234:thumb") from template to create correct output.

Here application get "1234:thumb" and "3456:thumb" from template and create images based on these value. If imagecreation was successful (both images), path to images written back to output:

<td><img src="images/1234.jpg" /><img src="images/3456.jpg" /></td>

If either of images wasn't created, default value ("images are missing") written to output:

<td>images are missing</td>

So 2 questions:

  1. is it possible to store that values in template and parse them?
  2. what is correct way to output default value (if/else in template or in application)?