我正在开发一个小工具,以显示主页上的内容推送。推送模型如下。
公共类PushRecord : ContentPartRecord {公共虚拟字符串头部{ get;set;}公共虚拟字符串文本{ get;set;}公共虚拟字符串Url { get;set;}}
在管理员上,我修改了推送小部件的ContentType以添加媒体选取器字段。我想做一个超链接周围的图像与网址由PushPart提供。Npw小部件由两个模板呈现: Parts.Push.cshtml和Fields.MediaPicker-PushWidget-Image.cshtml。我如何合并这两个并使我的推送渲染成为可能?任何帮助都是非常感谢的。
发布于 2012-03-17 09:24:37
也许可以尝试通过placement.info禁止显示mediapickerfield,然后使用来自PushPart的.cshtml的超链接显式地呈现图像。您可以像这样访问MediaPickerField url:
@{
var pushPart = Model.ContentPart;
var photoUrl = pushPart.MediaPickerFieldName.Url;
}
<a href="@GetYourUrlFromPushPart"><img src="@photoUrl" ... /></a>https://stackoverflow.com/questions/9746049
复制相似问题