An example of a custom Chloe component
Furnace framework » Furnace presentation layer » Chloe templates » Extending Chloe » Extending Chloe with custom components


As an example, let's develop a custom Chloe component which renders an image stored in a form value. Since the component does not require any configuration, we can define a singleton class:

Now we define a method on the render* generic word which renders the image using XML literals:
M: image render* 2drop [XML <img src=<-> /> XML] ;

Finally, we can define a Chloe component:

We can use it as follows, assuming the current form has a value named image:
<t:image t:name='image' />