【问题标题】:Cannot edit images inside sitecore field renderer无法在 sitecore 字段渲染器中编辑图像
【发布时间】:2013-09-09 03:30:09
【问题描述】:

我已将 Sitecore 字段渲染器用于我的一个页面,以便在 Sitecore 页面编辑器中进行编辑。该页面包含一张需要从 Sitecore 媒体库中引用的图片。

所以我将图像控件插入到 Sitecore 字段渲染器的标记中,如下所示

<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />

“~/media/Images/What is a Business Account/businessAdFeatures.ashx”是存储在 Sitecore 媒体文件夹中的图像的路径。

现在图像在页面内正确呈现,但是当我尝试使用 Sitecore 页面编辑器编辑该图像(上传新图像)时,它不允许我。

当我在 Sitecore 页面编辑器中打开该页面时,有什么方法可以使图片可编辑(上传新图片)?

谢谢


感谢您的想法。

但我的问题有点不同。我的示例页面中有 Sitecore 字段渲染器。

<sc:FieldRenderer ID="frTestPage" runat="server" />

从该页面后面的代码中,我绑定了一个 Sitecore 项,如下所示。

frTestPage.Item = DatabaseManager.MasterDatabase.GetItem(“itemID1”);
frTestPage.FieldName = "Content";

在我绑定到字段渲染器的项目中,它具有丰富的文本框字段名称“内容”。

在“内容”字段中,我插入了要呈现到页面的标记。因此该标记由以下 img 标记和其他相关 HTML 组成。

<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />

那么我怎样才能正确地给出引用 Sitecore 媒体库中图像的图像 src 路径。

【问题讨论】:

    标签: asp.net sitecore


    【解决方案1】:

    对图片使用硬编码路径是错误的: 你可以看到所有参数here

    如果你使用 XSLT 来渲染你的图像,你可以直接在sc:image 上应用参数:

    <sc:image field="MyImage" width="150" height="100" bc="ffffff"/>
    

    如果您使用 UserControls (.ascx) 来渲染图像,您可以注册以下标记前缀来访问sc:Imagesc:FieldRenderer

    <%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
    

    【讨论】:

      【解决方案2】:

      您可以使用编辑(页面编辑器),然后更多 -> 插入图像,请参阅:

      另外,要拥有更多编辑选项,您可以使用“编辑相关项目”

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-08
        • 1970-01-01
        相关资源
        最近更新 更多