Copied to clipboard

Flag this post as spam?

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


  • liran 59 posts 140 karma points
    Sep 10, 2011 @ 20:27
    liran
    0

    nivoslider

    hi all

    i hope this is the right place for this question...

    i installed nivoslide, followed the installation guide but when i try to add the nivoslide macro i get an error:

    Error loading Razor Script NivoSlider.cshtml
    'umbraco.MacroEngines.DynamicMedia' does not contain a definition for 'nivoSliderEffect'
    i'm a newb, where and what i need to add for the nicoslide to work?
    Liran
  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Sep 12, 2011 @ 17:21
    Sebastiaan Janssen
    0

    I am not sure about the NivoSlider package, but try adding ?umbDebugShowTrace=true to the URL and look at the trace, there should be a red error somewhere, could you copy that? Also, there will be a line number in that error, it would be handy to see the code at that line so that we can suggest solutions.

  • liran 59 posts 140 karma points
    Sep 15, 2011 @ 12:38
    liran
    0

    hi

    could you be a bit more specific, i'm very new at umbraco.

    in what file to add the URL? and what code should i sent to you?

    10x

    liran

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Sep 15, 2011 @ 13:36
    Sebastiaan Janssen
    0

    If your url is: http://mygreatsite.com/gallery.aspx then add http://mygreatsite.com/gallery.aspx?umbDebugShowTrace=true to see the complete stack trace and a more detailed error.

    The code I am asking for is the code you wrote in NivoSlider.cshtml.

  • liran 59 posts 140 karma points
    Sep 15, 2011 @ 13:51
    liran
    0

    i didn't wrote any code.... it was a package installation in Umbraco.

    but this is the code of: NivoSlider.cshtml

    @using umbraco.MacroEngines

    <script type="text/javascript" src="/scripts/jquery-1.6.2.min.js"></script>
    <script type="text/javascript" src="/scripts/jquery.nivo.slider.pack.js"></script>
    @{
        var nodes = @Model.MediaById(@Parameter.nivoFolder);
       

    <script type="text/javascript">
        $(window).load(function() {
            $('#@nodes.Name').nivoSlider({
              effect:@{
                System.Text.StringBuilder effects = new System.Text.StringBuilder("'");
                foreach (dynamic img in nodes.Children)
                {
                    if (img.nivoSliderEffect == String.Empty)
                    {
                        effects.Append("random,");
                    }
                    else
                    {
                        effects.Append(img.nivoSliderEffect + ",");
                    }
                }
                effects.Remove(effects.Length - 1,1);
                effects.Append("'");           
                @Html.Raw(effects.ToString());
              },         
              slices:@nodes.Children.Items.Count,
              boxCols:@(String.IsNullOrEmpty(Parameter.nivoBoxCols) ? "8" : Parameter.nivoBoxCols),
              rowCols:@(String.IsNullOrEmpty(Parameter.nivoRowCols) ? "4" : Parameter.nivoRowCols),
              animSpeed:@(String.IsNullOrEmpty(Parameter.nivoAnimSpeed) ? "500" : @Parameter.nivoAnimSpeed),
              pauseTime:@(String.IsNullOrEmpty(Parameter.nivoPauseTime) ? "3000": @Parameter.nivoPauseTime),
              startSlide:@(String.IsNullOrEmpty(Parameter.nivoStartSlide) ? "0" : @Parameter.nivoStartSlide),                    
              directionNav:@(String.IsNullOrEmpty(Parameter.nivoDirectionNav) ? "false" : (Parameter.nivoDirectionNav=="1" ? "true" : "false")),
              directionNavHide:@(String.IsNullOrEmpty(Parameter.nivoDirectionNavHide) ? "false" : (Parameter.nivoDirectionNavHide=="1" ? "true" : "false")),
              controlNav:@(String.IsNullOrEmpty(Parameter.nivoControlNav) ? "false" : (Parameter.nivoControlNav=="1" ? "true" : "false")),                                       
              keyboardNav:@(String.IsNullOrEmpty(Parameter.nivoKeyboardNav) ? "false" : (Parameter.nivoKeyboardNav=="1" ? "true" : "false")),
              pauseOnHover:@(String.IsNullOrEmpty(Parameter.nivoPauseOnHover) ? "false" : (Parameter.nivoPauseOnHover=="1" ? "true" : "false")),
              manualAdvance:@(String.IsNullOrEmpty(Parameter.nivoManualAdvance) ? "false" : (Parameter.nivoManualAdvance=="1" ? "true" : "false")),
              captionOpacity:@(String.IsNullOrEmpty(Parameter.nivoCaptionOpacity) ? "0.8" : @Parameter.nivoCaptionOpacity),
              prevText:@(String.IsNullOrEmpty(Parameter.nivoPrevText) ? @Html.Raw("'Prev'") : @Html.Raw(String.Concat("'", Parameter.nivoPrevText, "'"))),
              nextText:@(String.IsNullOrEmpty(Parameter.nivoNextText) ? @Html.Raw("'Next'") : @Html.Raw(String.Concat("'", Parameter.nivoNextText, "'")))
            });
        });           
    </script>
          
            <div id="@nodes.Name" class="nivoSlider">
           
                @foreach (dynamic img in nodes.Children)
                {
                    if (img.ContentType.Alias != "NivoSliderImage")
                    {
                        continue;
                    }
                   
                    dynamic destNode = new DynamicNode(img.nivoSliderUrl);
                    System.Text.StringBuilder htmlNode = new System.Text.StringBuilder();
                   
                    if (!String.IsNullOrEmpty(img.nivoSliderUrl))
                    {
                        htmlNode.Append("<a href=\""+destNode.NiceUrl+"\">");                   
                    }
                   
                    htmlNode.Append("<img src=\""+img.umbracoFile+"\" alt=\""+img.Name+"\"");
                   
                    if (!String.IsNullOrEmpty(img.nivoSliderCaption))
                    {
                        htmlNode.Append(" title=\"#"+img.Name+"\"");                                  
                    }
                   
                    htmlNode.Append("/>");
                   
                    if (!String.IsNullOrEmpty(img.nivoSliderUrl))
                    {
                        htmlNode.Append("</a>");
                    }

                    htmlNode.AppendLine();
                    @Html.Raw(htmlNode.ToString());               
                }
                          
            </div>
           
        foreach (dynamic img in nodes.Children)
        {
            if (!String.IsNullOrEmpty(img.nivoSliderCaption))
            {
                    <div id="@img.Name" class="nivo-html-caption">
                        @Html.Raw(img.nivoSliderCaption)
                    </div>                         
            }
        }
    }

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Sep 15, 2011 @ 13:55
    Sebastiaan Janssen
    0

    You probably added this package later when (some) images already existed.

    They got updated with the new properties, one of which is the nivoSliderEffect property.

    You have to go into ALL of your images and save them again so that the nivoSliderEffect contains an empty string (they are probably returning null or DynamicNull at the moment).

  • liran 59 posts 140 karma points
    Sep 15, 2011 @ 14:44
    liran
    0

    hi

    i think i have a problem with the properties.

    look at this screenshot:

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Sep 15, 2011 @ 14:51
    Sebastiaan Janssen
    0

    Did you save all of your media items again? Please go through all of them.

    Your properties don't give errors, so I don't know what the problem would be then.

  • liran 59 posts 140 karma points
    Sep 15, 2011 @ 15:07
    liran
    0

    hi

    i saved all the pictures again, still the same error.

     

  • Barry Fogarty 493 posts 1129 karma points
    Sep 17, 2011 @ 15:33
    Barry Fogarty
    1

    Hi liran, if you set up Umbraco via WebMatrix, and include one of the sample starter kits, that will give you a good clean base to try to get it to work.  Install the package and create a couple of sample slides, ensuring the properties on the slides are all set correctly.  Also ensure that you include the razor macro in the right template, i.e. the one whose Model will be the node that actually contains nivo slide references. 

    I have not used the package so not sure exaclty, but sounds like the linkage is broken, i.e. the page you are using the macro on cannot see the nivo slide properties for some reason. 

Please Sign in or register to post replies

Write your reply to:

Draft