I guess I am okay with this for now, but could you look at my syntax for 2 things in the for loop that lists the NewsArticles:
I am trying to get the "NewsCategory" Name from the current article, but it's not working. The NewsCategory is a Ancestor of the current node, so I thought I could reference it that way in the loop. Nope..
I am also trying to get an image from the media library with the property of "featuredImage". The if statement works, but I only get the "Hello World" text output in the image's place.
Going back, It does look like I'll have to be able to select the articles from the docType of "DateFolder" and I just can't seem to get that to work at all.
I don't understand why this won't work to get the children of the children of another node using something like this:
var articles = Model.AncestorOrSelf("NewsHome").Children.Where("NodeTypeAlias == \"NewsCategory\"").Children.Where("NodeTypeAlias == \"DateFolder\"");
Problems with Children
I am constructing a Razor script to paginate our NewsArticles, but when I try to access them using :
Where the structure looks like my photo attachment, the script fails to load. What's wrong with my syntax?
I get a casting error when I use your lambda.
sorry , I tried to delete my comment as fast as I could
Here is the entire Razor:
can you try this sir steve :
I have tried this, and it does list all the articles, but I need only the articles contained (children) in the folder of the docType "DateFolder".
Otherwise, I get some unneeded articles that are outside the DateFolders.
Would you be willing to do something like:
This will use uQuery and just get all the children at that URL of the NodeType.
I guess I am okay with this for now, but could you look at my syntax for 2 things in the for loop that lists the NewsArticles:
I am trying to get the "NewsCategory" Name from the current article, but it's not working. The NewsCategory is a Ancestor of the current node, so I thought I could reference it that way in the loop. Nope..
I am also trying to get an image from the media library with the property of "featuredImage". The if statement works, but I only get the "Hello World" text output in the image's place.
@foreach (var item in articles.OrderBy("CreateDate descending").Skip((page - 1) * pageSize).Take(pageSize)) {
var newsCategory = @Model.Ancestor("NewsCategory");
Going back, It does look like I'll have to be able to select the articles from the docType of "DateFolder" and I just can't seem to get that to work at all.
I don't understand why this won't work to get the children of the children of another node using something like this:
var articles = Model.AncestorOrSelf("NewsHome").Children.Where("NodeTypeAlias == \"NewsCategory\"").Children.Where("NodeTypeAlias == \"DateFolder\"");
is working on a reply...