To retrieve an image URL from a page, I do:
@UI.Content(Model.Regions.ProfilePicture.Id)
But how do I get images from current site Regions?
If you're running ASP.NET WebPages and your Layout page inherits from Piranha.WebPages.LayoutPage you can access the Site Model from the layout page by using:
@Model.Regions....
However, since layout pages in MVC don't get a separate model in the same way you'll have to load it manually. To load the current site model, you can use the following piece of code and pass it to your view:
if (Page.Current != null) {
MySiteModel = Models.PageModel.GetBySite(Page.Current.SiteTreeId) ;
} else MySiteModel = Models.PageModel.GetBySite(Config.SiteTreeId) ;
This will load the site model for the site of the current page, or the current site tree id if you're not on a page. As you can see, the site model is in fact a special page model attached to the root of the site.