Place content in zones using Placement.info

Topics: Writing modules
Nov 28, 2012 at 3:34 PM
Edited Nov 28, 2012 at 3:35 PM

Hello,

I'm new to Orchard and I would like to thank everyone in the community for this REALLY powerful application. I'm writing you beacuse i'm having rough times while understanding shapes placement in zones. I've read a lot of threads talking about this but I still don't know how to achieve what i need (if it is possible of course)

What I want to do is quite simple. I have written a module which consists of a widget that fetch data from a WebService and display it in a grid. It works perfectly. Now, I need to display static text in the AsideFirst zone (TheThemeMachine).

I have a template named Hello.cshtml in my /view folder in my project wich looks like that:

<h2>Hello</h2>



As you can see there is nothing much in this, just static text. What i need to do is to push that template into AsideFirst zone (using placement.info) when the admin Enable my module.

 I don't know if i'm clear enough, just tell me if you need more explanations,
Thanks in advance

Pat

Nov 28, 2012 at 3:49 PM
altraspat wrote:

Hello,

I'm new to Orchard and I would like to thank everyone in the community for this REALLY powerful application. I'm writing you beacuse i'm having rough times while understanding shapes placement in zones. I've read a lot of threads talking about this but I still don't know how to achieve what i need (if it is possible of course)

What I want to do is quite simple. I have written a module which consists of a widget that fetch data from a WebService and display it in a grid. It works perfectly. Now, I need to display static text in the AsideFirst zone (TheThemeMachine).

I have a template named Hello.cshtml in my /view folder in my project wich looks like that:

<h2>Hello</h2>



As you can see there is nothing much in this, just static text. What i need to do is to push that template into AsideFirst zone (using placement.info) when the admin Enable my module.

 I don't know if i'm clear enough, just tell me if you need more explanations,
Thanks in advance

Pat


Hey dear,

You can use Shape Tracing Module and use Widget Alternative to create an alternative .cshtml file for AsideFirst zone which will be created in your Theme's folder

Nov 28, 2012 at 4:00 PM

Thanks for fast answer,

Yeah, i suppose that's a great idea but i would prefer not to alter default theme. Keep in mind that all my stuff will have to be in my module project to allow them to be distributed. If I modify the theme, it won't be packaged with my module...

Thanks again,

Pat

Nov 28, 2012 at 6:13 PM

The problem with inserting something into a predefined zone is that there is no guarantee that such a zone will exist in the user's theme. For instance, I tend to write themes using AsideLeft and AsideRight.

What you should do is to provide a widget through your module that can be placed into a zone using the layers and widgets configuration. This way, they can place it where they want and it will always work.

Nov 28, 2012 at 7:23 PM

Oh I see,

I suppose if i have:
- a search engine in AsideLeft;
- a list in Content;
- related content in the AsideRight;
- a contact form in footer;

 Will I have to create 4 differents widgets?
Is there another way to do this?

Regards!

Pat

Nov 28, 2012 at 10:04 PM

You would have to. There are already widgets that do all of those things, but I'm guessing you want to make a suite of widgets that pull from this web service you mentioned.

Nov 29, 2012 at 12:09 PM

Well thanks a lot.

You answered perfectly to my interrogations.
I guess this subject is now closed.

I fyou tell me there are already widgets that are doing all this, i'll have to look into the gallery for those.

Thank you again CPyle :)