Copied to clipboard

Flag this post as spam?

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


  • Michael Jensen 29 posts 98 karma points
    May 11, 2018 @ 09:03
    Michael Jensen
    0

    Image Slider Macro problem

    Hey,

    im making a new weebpaker for a body off live using Umbraco version 7.10.2 and for som reason I can't get my head around why my macro dont work.

    This is how it looks

    @inherits umbraco.MacroEngines.DynamicNodeContext
    

    @{ var startNodeID = Parameter.nodeId; }

    @if (startNodeID != null) {
    @* Get the start node as a dynamic node *@ var startNode = Library.NodeById(startNodeID);

    if (startNode.Children.Where("Visible") .Any())
    {       
        <ul>
            @foreach (var page in startNode.Children.Where("Visible"))
            {
                <li onHoverStop: 'on' data-transition="@page.data-transition" data-slotamount="@page.data-slotamount" data-masterspeed=" @page.data-masterspeed" data-saveperformance="@page.data-saveperformance" data-title="@page.data-title">
    
                                <!-- LAYER Headline -->
                                <div class="tp-caption SliderTekstHeadline sfr tp-resizeme"
                                    data-x="0"
                                    data-y="70" 
                                    data-speed="600"
                                    data-start="1200"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideHeadline
                                </div>
    
                                <!-- LAYER Textline 1 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="140" 
                                    data-speed="600"
                                    data-start="1600"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst1
                                </div>
    
    
                                <!-- LAYER Textline 2 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="190" 
                                    data-speed="600"
                                    data-start="2000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst2
                                </div>
    
    
                                <!-- LAYER Textline 3 -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="240" 
                                    data-speed="600"
                                    data-start="2400"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst3
                                </div>
    
                                <!-- LAYER Textline 4 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="290" 
                                    data-speed="600"
                                    data-start="3200"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst4
                                </div>
    
    
                                <!-- LAYER Textline 5 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="340" 
                                    data-speed="600"
                                    data-start="3600"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst5
                                </div>
    
    
                                <!-- LAYER Textline 6 -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="390" 
                                    data-speed="600"
                                    data-start="4000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst6
                                </div>
    
                                   <!-- LAYER Link -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="440" 
                                    data-speed="600"
                                    data-start="4000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideLink
                                </div>
    
                                <!-- LAYER Image -->
                                <div class="tp-caption sfr tp-resizeme SliderImage"
                                    data-x="570"
                                    data-y="center" 
                                    data-speed="600"
                                    data-start="2200"
                                    data-end="9400"
                                    data-endspeed="600">
                                    <img src="@page.image" class="SliderRadius" alt="@page.altText" />
                                </div>
    
                                </li>
            }
        </ul>
    }
    

    }

    I hvae tryed to convert it to XSLT but my problem is I can get it to work and the problem is in this line

    <li onHoverStop: 'on' data-transition="@page.data-transition" data-slotamount="@page.data-slotamount" data-masterspeed=" @page.data-masterspeed" data-saveperformance="@page.data-saveperformance" data-title="@page.data-title">
    

    I can't wrap my head around it to get it to work

    I hop som can help me

    Best regards Michael

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 11, 2018 @ 09:08
    Alex Skrypnyk
    0

    Hi Michael

    You are using old methods, header I would rewrite to:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @{
        var startNodeID = Model.MacroParameters["nodeId"];
    
    }
    
    @if (startNodeID != null)
    {
        @* Get the start node as a dynamic node *@ 
        var startNode = Umbraco.Content(startNodeID);
    
        if (startNode.Children.Where("Visible").Any())
        {
            <ul>
                @foreach (var page in startNode.Children.Where("Visible"))
                {
    

    And it's not a strongly typed also, so not perfect.

    where you have a problem, code like that doesn't work:

    @page.data-masterspeed
    

    Are you sure you have "data-masterspeed" property alias? Maybe "dataMasterspeed?

    Thanks,

    Alex

  • Michael Jensen 29 posts 98 karma points
    May 11, 2018 @ 09:43
    Michael Jensen
    0

    Hey Alex,

    Well you is right about the @page.data-masterspeed but I dint look at as I use the macro on a mother site ware it works 100 %. whit that error

    i made the chance you advice me to and now my page dont fail in loading but gifs this. Error loading MacroEngine script (file: ForsideSlider.cshtml)

    This is how it looks like now have I miss something

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    

    @{ var startNodeID = Model.MacroParameters["nodeId"]; }

    @if (startNodeID != null) { @* Get the start node as a dynamic node *@ var startNode = Umbraco.Content(startNodeID);

    if (startNode.Children.Where("Visible").Any())
    {
        <ul>
            @foreach (var page in startNode.Children.Where("Visible"))
            {
                <li onHoverStop: 'on' data-transition="@page.dataTransition" data-slotamount="@page.dataSlotamount" data-masterspeed=" @page.dataMasterspeed" data-saveperformance="@page.dataSaveperformance" data-title="@page.dataTitle">
    
                                <!-- LAYER Headline -->
                                <div class="tp-caption SliderTekstHeadline sfr tp-resizeme"
                                    data-x="0"
                                    data-y="70" 
                                    data-speed="600"
                                    data-start="1200"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideHeadline
                                </div>
    
                                <!-- LAYER Textline 1 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="140" 
                                    data-speed="600"
                                    data-start="1600"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst1
                                </div>
    
    
                                <!-- LAYER Textline 2 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="190" 
                                    data-speed="600"
                                    data-start="2000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst2
                                </div>
    
    
                                <!-- LAYER Textline 3 -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="240" 
                                    data-speed="600"
                                    data-start="2400"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst3
                                </div>
    
                                <!-- LAYER Textline 4 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="290" 
                                    data-speed="600"
                                    data-start="3200"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst4
                                </div>
    
    
                                <!-- LAYER Textline 5 -->
                                <div class="tp-caption sfb SliderTekst tp-resizeme"
                                    data-x="0"
                                    data-y="340" 
                                    data-speed="600"
                                    data-start="3600"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst5
                                </div>
    
    
                                <!-- LAYER Textline 6 -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="390" 
                                    data-speed="600"
                                    data-start="4000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideTekst6
                                </div>
    
                                   <!-- LAYER Link -->
                                <div class="tp-caption SliderTekst sfb tp-resizeme"
                                    data-x="0"
                                    data-y="440" 
                                    data-speed="600"
                                    data-start="4000"
                                    data-end="9400"
                                    data-endspeed="600">@page.slideLink
                                </div>
    
                                <!-- LAYER Image -->
                                <div class="tp-caption sfr tp-resizeme SliderImage"
                                    data-x="570"
                                    data-y="center" 
                                    data-speed="600"
                                    data-start="2200"
                                    data-end="9400"
                                    data-endspeed="600">
                                    <img src="@page.image" class="SliderRadius" alt="@page.altText" />
                                </div>
    
                                </li>
            }
        </ul>
    }
    

    }

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 11, 2018 @ 09:45
    Alex Skrypnyk
    0

    Try to wrap "onHoverStop: 'on'" into

    <li <text>onHoverStop: 'on'</text> 
    
  • Michael Jensen 29 posts 98 karma points
    May 11, 2018 @ 09:48
    Michael Jensen
    0

    Nop dint work i even relived it.. you can se the site her. Levins

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    May 11, 2018 @ 09:49
    Alex Skrypnyk
    0

    Can you have a look at app_data/logs?

  • Michael Jensen 29 posts 98 karma points
    May 11, 2018 @ 09:52
    Michael Jensen
    0

    Yes this is the log

    2018-05-11 11:51:18,909 [P1452/D2/T83] WARN umbraco.macro - Error loading MacroEngine script (file: ForsideSlider.cshtml, Type: ''. Exception: System.InvalidCastException: Context Must Implement System.Web.WebPages.WebPage at umbraco.MacroEngines.RazorMacroEngine.CompileAndInstantiate(String virtualPath) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage) at umbraco.macro.loadMacroScript(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

  • Michael Jensen 29 posts 98 karma points
    May 11, 2018 @ 10:10
    Michael Jensen
    0

    Hey Alex,

    whit the help you provided I believe I have fix it now the XSLT works I believe this it how it looks. I shows up and runs it dos not restart bud I believe I just ned to twerk on som.

    will not show the code even if use a code tag

    <?xml version="1.0" encoding="UTF-8"?>
    

    ]>

Please Sign in or register to post replies

Write your reply to:

Draft