Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
is there an easy way to iterate both content and media through a collection? I know I can use Umbraco.TypedContentAtRoot() and Umbraco.TypedMediaAtRoot() but is there an easy way to do both through a single call? I would like to iterate through a single collection if possible.
from a template i don't think you can get both in one call - content and media are cached in different ways - so there are two caches and you have to do the two calls. :-(
You can use some of the back office services to get media and content objects in one collection - but you shouldn't do this from your razor templates or any front end code because it will hit the db and be way slower.
You can however get both elements back using examine - as the search index will have everything in - but this won't give you IPublishedContent elements, as it will give you the search results instead - but it depends on what exactly you need when going through the collections.
Went the Examine route. Thank you for the input.
You mean you want to access both media and content in a single collection, together? Otherwise you can probably query the cache for a wildcard XPath!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted