hey guys ive recently used the smartblog plugin for my news section in 7.1 umbraco
So far so good, theres another section where the design is very similar to this so i wanted to re-use.
i left the content types the same and decided to create a new set of templates that are very close to the original, then create content pages from those new templates, which seems fine.
However when i try to check my functionality i noticed that i use this line on my templates.
Descendants of template
hey guys ive recently used the smartblog plugin for my news section in 7.1 umbraco
So far so good, theres another section where the design is very similar to this so i wanted to re-use.
i left the content types the same and decided to create a new set of templates that are very close to the original, then create content pages from those new templates, which seems fine.
However when i try to check my functionality i noticed that i use this line on my templates.
Checking this, it find tbhe alias of a content type.......Oh dear :(
What i need is the exact same functionality, only finding the descendants based on template alias rather then contentType alias.
Any ideas? is that possible? If not will i be forced to make new content types?
cheers guys
Does this work?
var blogRoot = Model.Content.AncestorsOrSelf() .FirstOrDefault(x => x.GetTemplateAlias() == "SmartBlogBlog");
Andy
got switched onto a lovely email build, will check tomorrow, but that seems like it will work at first glance. Cheers for that Andy!
hey andy tried it, but It says IpublishedContent does not have an extension method for FirstOrDefault(). Any alternative?
investiagting turns out thats what ancesterordelf actually does, it gets the correct template information so theres actually no code change haha.
thanks anyway
is working on a reply...