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"];
Error loading macro
Hey, I am using code which worked on another site page the same, but for some reason it is now erroring:
This is what I am calling:
<umbraco:Macro ItemCount="2" Small="1" Alias="uBlogsyListPosts" runat="server"></umbraco:Macro>
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)
}
}
}
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
is working on a reply...