I would like to have some kind of binding variable in my template so I can make a decision whether the request is coming from the publish or for preview.
I saw somewhere you can setup this filter and then you can have the if condition block in your templates to handle differently preview and publish.
I implemented a binding that checked $sys.params.sys_itemfilter, so that the binding is based on the Item Filter selected in the content list and passed as a parameter for the assembly request. There are other attributes of $sys.params, such as sys_siteid and sys_context - maybe there is something there that work for your purpose (sys_context seems the most likely). There’s a list of the available parameters on page 410 of the Rhythmyx 6.5.2 Implementation Guide.
If you would like to render different markup in your templates depending on whether the item is being published or a user is using the active assembly preview you can:
Create a binding, $isPublish = $tools.number.toNumber($tools.list.get($sys.params.get(‘sys_context’),0)) > 0
In the template add the code: #if( $isPublish)
Output markup for published page #else
Output markup for active assembly preview #end
Technically you do not need a binding, but it is cleaner in the markup that way.