Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amourie 12 posts 41 karma points
    Nov 27, 2013 @ 22:29
    Amourie
    0

    How to display embed code of type Textbox multiple in my template

    Hi guys

    I've got a question please: how do I display embed code entered into a field of type Textbox multiple in my template.

    My field has and ID of 'embedCode'. My template code is below and when I view the page the second bit of code is the code that works: 

    The bit of code that doesn't work:

    if(Model.HasValue("embedCode"))

    {

     

    @Model.embedCode

     

    }

     

    It ends up rendering:

     

    umbraco.MacroEngines.DynamicXml

     

     

    I would really appreciate any help I can get as I'm trying to get rid of these server side components and replace it with razor code instead.

    Many thanks in advance :)

     

    Full page code below:

    <%@ Master Language="C#" MasterPageFile="~/masterpages/MMasterTemplate.master" AutoEventWireup="true" %>

    <asp:content ContentPlaceHolderId="ContentPlaceHolder_HeadContent" runat="server">

    </asp:content>

     

    <asp:content ContentPlaceHolderId="ContentPlaceHolder_PageContent" runat="server">

    <umbraco:Macro runat="server" language="cshtml">

     

    @{ 

      if((Model.HasValue("mainImage")) && (Model.HasValue("mainImageLink")))

    {

    <div class="largeImg">

    <a href="@Model.mainImageLink">

    <img src="@Model.MainImage" />

    </a>

    </div>

     

    else if((Model.HasValue("mainImage")) && (!Model.HasValue("mainImageLink")))

    {

    <div class="largeImg">

    <img src="@Model.MainImage" /> 

    </div>

    }

    if(Model.HasValue("bodyText"))

    {

    <div>

    @Model.bodyText

    </div>

    }

    if(Model.HasValue("embedCode"))

    {

    <div class="embedCodeUpper">

    @Model.embedCode

    </div>

    }

     

    }    

        </umbraco:Macro>

    <div class="embedCode"><umbraco:Item field="embedCode" runat="server" /></div>

    </asp:content>

     

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies