如何包括Sitecore的锚标记中的HTML [英] How to include html inside anchor tag in Sitecore

查看:211
本文介绍了如何包括Sitecore的锚标记中的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,有HTML锚标记中。而笔者应该能够编辑两个锚(HREF)及等领域。

I have a situation where there is HTML inside an anchor tag. And the author should be able to edit both the anchor (href) & other fields.

ASPX:

<asp:Repeater ID="rpEvents" runat="server" ItemType="Sitecore.Data.Items.Item">
 <HeaderTemplate>
  <div class="col-md-3">
 </HeaderTemplate>
 <ItemTemplate>
  <a href="offers/spring.html">
    <sc:Image runat="server" Field="offer image" Item=<%#Container.DataItem%> />
    <h3><sc:Text runat="server" Field="Offer Title" Item=<%#Container.DataItem%> /></h3>
  </a>
 </ItemTemplate>
 <FooterTemplate>
  </div>
 </FooterTemplate>
</asp:Repeater>

我会通过转动&LT做到这一点; A&GT; &LT; ASP:超链接&GT; &安培;从code指派其NavigateUrl属性后面,但在经验的编辑作者不能编辑它。

I would do this by turning the <a> into <asp:Hyperlink> & assigning its NavigateURL property from code behind, but then the author cannot edit it in experience editor.

这是如何在Sitecore的完成。

How is this done in Sitecore.

推荐答案

您可以使用链接领域,这将使所有领域继续从经验编辑器编辑包裹其他HTML元素:

You can wrap the other HTML elements using the Link field, which will allow all fields to continue to be edited from the Experience Editor:

<ItemTemplate>      
    <sc:Link Field="Offer Link" Item="<%# Container.DataItem %>" runat="server">
        <sc:Image Field="Offer Title" Item="<%# Container.DataItem %>" runat="server" />
        <h3><sc:Text Field="offer image" Item="<%# Container.DataItem %>" runat="server" /></h3>
    </sc:Link>
</ItemTemplate> 

该链接仍然可以设置,图像改变,或者单独的文本字段编辑:

The Link can still be set, the image changed or the separate text field edited:

在这里输入的形象描述

这篇关于如何包括Sitecore的锚标记中的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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