Velocity Template Binding

Hi,

I have a variable (“default_css”) defined in preview context for preview site and other contexts for publishing sites.

If I want to use this variable in a velocity template, do I register it in bindings of the template?

If so, is the following binding correct?
variable name: $css
value: $sys.variables.default_css

Thanks

runping

Runping,

You can define a binding variable, and your code defines it correctly. But you do not have to register a binding variable. You can use $sys.variables.variablename directly in your Template source code.

For more details, see “Converting References to Static Files”, p. 180 in the Rhythmyx Implementation Guide.

RLJII

Thanks.

I have tried it in our environment. It doesn’t work for a variable defined for the preview site of preview context. I have attached a screen shot of the variable definition. On the template, I use $sys.variables.var_test (var_test is the variable name). When previewing it, the variable is not evaluated.

Here is the URL in preview:
http://(server name):9992/Rhythmyx/assembler/render?sys_revision=10&sys_itemfilter=preview&sys_template=744&sys_contentid=9941&sys_context=0

I suspicious if this is caused by the preview site whose site id is equal to 0. I can not locate the site definition for it inside Rhythmyx or backend database table (RXSITES).

Thank you.

Runping,

I suggest you contact Tech Support. They can troubleshoot your issue more effectively than we can over the forum.

RLJII

thank you, i will have a chat with tech support.