Copied to clipboard

Flag this post as spam?

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


  • Guy Pucill 23 posts 73 karma points
    May 06, 2014 @ 18:05
    Guy Pucill
    0

    RTE Macros in 7.1.1

    The following macro works perfectly when used in a template:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    
    @if (Model.HasValue("Fotos"))
        {
            foreach (var item in Model.GetProperty("Fotos").Value.Split(','))
            {
                <img src="@Model.MediaById(@item).umbracoFile" alt="" />
            }
    
        }
    

    Only the top part of the following Macro works when used in the RTE field:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    
        @* This give me nice media ID list like 1115,1114,1116 in the rte doc type *@
        @if(Html.Raw(Parameter.ListeAlias) != null)
        {
            <p>1 Test to see if Alias data can be found</p>
            @(Html.Raw(Parameter.ListeAlias))
        }
    
    @if (Model.Content.HasValue("ListeAlias"))
        {
            foreach (var item in Model.GetProperty("ListeAlias").Value.Split(','))
            {
                <p>2 Test to see if Alias data can be found</p>
                @Model.MediaById(@item).umbracoFile
            }
    
        }
    

    I have tried with:

    Model.Content.HasValue("ListeAlias")
    

    and

    Model.HasValue("ListeAlias")
    

    I some how need to reference the Alias data from the macro being used in the richtexteditor field.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft