Copied to clipboard

Flag this post as spam?

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


  • Pat 56 posts 147 karma points
    Jan 18, 2012 @ 20:09
    Pat
    0

    Error loading macro

    Hey, I am using code which worked on another site page the same, but for some reason it is now erroring:

  • Pat 56 posts 147 karma points
    Jan 18, 2012 @ 20:11
    Pat
    0

    This is what I am calling:

    <umbraco:Macro ItemCount="2" Small="1" Alias="uBlogsyListPosts" runat="server"></umbraco:Macro>

  • Pat 56 posts 147 karma points
    Jan 18, 2012 @ 21:18
    Pat
    0

    And the .cshtml file is this (again, this was working before) ... 1106 is the landing node for my blog:

    // get all posts
       
        
        var landing = new DynamicNode(1106).Parent.GetChildrenAsList.Items.Where(x => x.NodeTypeAlias == "uBlogsyLanding").Single();
        IEnumerable<DynamicNode> postList = uBlogsy.Web.Helpers.NodeHelper.GetPosts(1106);
        
        // get item count
        int count = int.Parse(@Parameter.ItemCount);

        IEnumerable<DynamicNode> nodes;

        if (@Parameter.Small == "1")
        {
            nodes = postList.Take(count);
            <div class="uBlogsy_posts_container uBlogsy_bottom_border">
           
                <ul>
                    @foreach (DynamicNode n in nodes)
                    {
                        <li>
                            <a href="@n.Url">
                                <span>@n.GetProperty("uBlogsyContentTitle").Value</span>
                            </a>
                           @* - <span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</span>*@
                        </li>
                    }
                </ul>
            </div>
        }
        else
        {
            // get tag, category, or author from query string
            var tag = Request.QueryString["tag"];
            var category = Request.QueryString["category"];
            var author = Request.QueryString["author"];
            var searchTerm = Request.QueryString["search"];

            nodes = NodeHelper.GetPosts(tag, category, author, searchTerm, postList).Take(count).ToList();
            
            if (!string.IsNullOrEmpty(searchTerm))
            {
                <script type="text/javascript">
                    $(document).ready(function () {
                        $('.uBlogsy_content_body').hide();
                    });
                </script>
                <h3>@nodes.Count() Results: </h3>
            }
             foreach (DynamicNode n in nodes)
             {
                   @RenderPage("/macroScripts/uBlogsyShowPost.cshtml", n.Id)
             }
        }
     }

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 19, 2012 @ 13:58
    Anthony Dang
    0

    hard to say

     

    try deleting everything in the macro script to see if it still errors

    if it doesnt, then start adding stuff back until you figure out the line

     

Please Sign in or register to post replies

Write your reply to:

Draft