Widget inside HTML with a placeholder

Topics: Customizing Orchard
Jul 26, 2012 at 4:17 PM

Hi, i'm trying to extend orchard with a feature that in my projects can be really usefull. In my web sites the layout is usally really complex and i need a way to avoid the creation of tons of zones for widgets.

The original idea is to create widget placeholders in page html (content) like this:


During shape render i would like to replace the placeholder with the rendered view of the widget. I tried to code this idea with bad results (i'm a noob in orchard development).

In DisplayHelper -> ShapeExecute i tried to rendere the widget but i don't know how to retrive and create the specific widget shape.

Can someone give me an advice?

Thank you

Jul 26, 2012 at 4:26 PM

Maybe it's not widgets that you need. Are the widgets dynamically determined for each "mini-zone"? If so, how are you going to manage that? If not, why not just Display some shapes from the view?

Jul 26, 2012 at 6:11 PM

Hi , thank you for the response,

thought to widget because they are very flexible and with them i can render everything (a form, a post list ..). I wrote a custom CMS with asp.net that has a similar feature and it's really useful (nothing compared to orchard). Is there a way to implement something like this? The widgets should be dynamically determined according to some filter in placeholders (id maybe).  

As i said i'm a noob here, maybe i'm missing something.. Thank you

Jul 27, 2012 at 12:54 PM

OK, so one thing you could do is declare some additional zone-like shapes in your layout and programmatically inject widget-like shapes in those. If you don't declare those zonoids in the theme.txt file, they won't appear in the widget management screen, but that doesn't mean they are not there for you to add stuff.

You would do @Display.MyPseudoZone() from your layout, and then Layout.MyPseudoZone.Add(someOtherShape).