I am currently constructing a little blog. A user can create a blog post and then inside the blog post they can select from a drop down the type it is e.g. funny/ scary/ films etc.
I have created this property and created a custom drop down type.
Is there a way on my site that I can search for a child node with a certain property?
@{
//moving to the page with the child items
//if you are on the blog page with children you can get the children by using Model.content.Children()
var home = Model.Content.AncestorsOrSelf("Home").First();
var blogs= home.Descendants("Blog").First();
}
@foreach (var blog in blogs.Children().Where(x => x.GetPropertyValue("type").Equals("funny")))
{
// do things with blog
}
Thanks. I'm trying to learn as much as possible though. As tempting as the packages are, like you said, they save a lot of time and hence do a lot of the work for you.
Searching for a category
Hi Guys,
I am currently constructing a little blog. A user can create a blog post and then inside the blog post they can select from a drop down the type it is e.g. funny/ scary/ films etc.
I have created this property and created a custom drop down type.
Is there a way on my site that I can search for a child node with a certain property?
Kind regards,
James.
Hey,
You can do this with the following:
Brill thanks for the response :)
😀
To make it even more dynamic you can get the page name with Model.content.Name so you can use that for the equals function
If you are using Umbraco 7 you can save yourself alot of time by using the blogging package written by Shannon http://our.umbraco.org/projects/starter-kits/articulate
Thanks. I'm trying to learn as much as possible though. As tempting as the packages are, like you said, they save a lot of time and hence do a lot of the work for you.
Thanks anyway.
is working on a reply...