Copied to clipboard

Flag this post as spam?

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


  • Nicolai 48 posts 201 karma points
    Mar 19, 2015 @ 22:02
    Nicolai
    0

    Whyed. All elements must be either self-closing or have a matching end tag.

    Im getting that error code when im trying to save my macro in umbraco. Here is my code:

     

      <tabel id="example">

      foreach (var page in allMagazines)

      {

    <tr>

    <td>

        @:<a href="@page.Url"><div class="magazine-thumbnail">

     

            <img src="@page.Media("magazineFrontpageImage", "umbracoFile")" width="155" height="220" />

     

          <div class="details">

            <p><strong>@page.magazineIssue</strong><br>@page.magazineTitle</p>

     

          </div>

        @:</div></a>

    </td>

    </tr>

      }

      </table>

     

    Can anyone see why im getting this error?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 19, 2015 @ 22:50
    Dennis Aaen
    0

    Hi Nicolai,

    First thing I discover in your code, is that you have made a little spelling mistake, the first table tag is <tabel> not <table> as it should be. The second thing is that everytime that you want to write some Razor code inside some HTML you need to start the Razor engine, to tell that it need to be interpreted as Razor. You do this be using the @ character.

    So try this code and see if you get your HTML table outputted.

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    <table id="example">
        @foreach (var page in allMagazines){
            <tr>
                <td>
                    test
                </td>
            </tr>
        }
    </table>

    In the example above I am using a partial view macro, if you are using a partial view then you need to change this line

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    To

    @inherits UmbracoTemplatePage

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft