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

renderSkin()

Renders a global skin and writes the result to the output buffer.

Syntax
renderSkin(String, ParameterObject)

A global skin is either a skin file inside the global directory of an application or a skin retrieved by createSkin(). 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 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 global/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";
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 12:33 by tobi