Helma logo
helma.org » Home > Stories > HopObject.renderSkin()

HopObject.renderSkin()

Renders a skin of a HopObject and writes the result to the output buffer.

Syntax
HopObject.renderSkin(String, ParameterObject)

The name of the skin is defined by the string parameter.

A skin can contain markup (e.g. HTML or XML) and macros. Macros are references to Helma functions wrapped in special tags (<% and %>). For more information about skin and macro techniques please refer to the section about About Skins.

Optionally, a JavaScript object can be assigned to the function call as second argument. This object's properties later can be accessed from the skin via macro calls of the kind <% param.propertyName %>.

If a param property is not set but referred to in the skin file, it will be replaced with an empty string. Please note that this behaviour is different from generic macro calls.

Example
Contents of the file root/example.skin:
<html>
<head>
   <title>Hello, <% param.title %>!</title>
</head>
<body bgcolor="<% param.bgcolor %>">
I greet you <% param.amount %> times.
</body>
</html>


Rendering the skin:
var param = new Object();
param.bgcolor = "#ffcc00";
param.title = "World";
param.amount = "12345";
root.renderSkin("example", param);

<html>
<head>
   <title>Hello, World!</title>
</head>
<body bgcolor="#ffcc00">
I greet you 12345 times.
</body>


... comment


Page last modified on 2002-07-16 13:49 by tobi