Kentico 7隐藏可编辑文本(如果为空) [英] Kentico 7 hide editable text if it's empty

查看:64
本文介绍了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.

这篇关于Kentico 7隐藏可编辑文本(如果为空)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆