How do I render a zone or a widget from inside an alternate?

Topics: Writing themes
Mar 16, 2012 at 9:18 AM
Edited Mar 16, 2012 at 9:19 AM

Cross-posting this from StackOverflow, in case there's a bigger audience here. SO question here: http://stackoverflow.com/questions/9733478/how-do-i-render-a-zone-or-a-widget-from-inside-an-orchard-alternate

I'm trying to replicate this page layout in Orchard: http://friendlythem.es/html_themes/venus/blog_post.html

So far, I've created a Content-BlogPost.Detail.cshtml that renders pretty much everything. But now I'd like to include a Blog Archives widget in there. Here's a picture of the layout I have in mind: http://i.stack.imgur.com/llvb2.jpg

My questions are:

  1. Is this the right way to lay things out, or is there a better way to get the desired result?
  2. How can I render a zone or a widget from inside my alternate?

Things I've tried/considered:

  1. @Display(Model.Archives): This obviously doesn't work because the model I have inside the blog detail alternate doesn't have a reference to the zone I'm talking about.
  2. @Display(New.Parts_Blogs_BlogArchives(new { Blog: blog, Archives: ???}): I'm not sure if this is a valid approach. If it is, how do I even populate that last argument?
Mar 16, 2012 at 3:46 PM
Edited Mar 16, 2012 at 3:47 PM

This has been answered on StackOverflow: http://stackoverflow.com/a/9737373/34985

The solution is to use @Display(Layout.Archives). Layout gives you access to the top-level zones. Please take a look at Piotr Szmyd's answer on StackOverflow for more details.