Kentico 7隐藏可编辑文本(如果为空)
我在页面模板上有一个可编辑的文本Web部件.它在文本前后都有一个自定义HTML信封.如果可编辑文本为空,如何隐藏整个内容(包括信封)?
I have an editable text web part on a page template. It has a custom HTML envelope before and after the text. How can I hide the whole thing, envelope included, if the editable text is empty?
我需要隐藏它,因为信封会添加风格化的标记,当没有文本时该标记将不可见.
I need to hide it because the envelope adds stylized markup that shouldn't be visible when there is no text.
可以在Visible属性上使用K#代码段来完成此操作吗?我不清楚询问文档属性的方式.
Can it be done with a K# snippet on the Visible property? I'm unclear how interrogating a document's property works.
谢谢!
尝试将其作为可见"属性:
Try this as the "Visible" property:
{% (ViewMode != "LiveSite") || (CMSContext.CurrentDocument.editabletext != "") #%}
将"editabletext
"更改为您的Web部件控件ID.
Change "editabletext
" to whatever you have for your web part control ID.