3
votes

I'm adding a 'contact form' page to an Orchard site (that I'm making to learn Orchard).

First I added it as a layer. Then I found out you can add it as a Content Type.

I find this all very confusing.

What is the difference & relationship between layers, content types, modules & widgets. And why are there no pages?!

Why is TripelFirst a layer for example - not a widget?

Why can't I just make a 'contact' page and add a widget to it called 'Contact Form'?!

What's the difference between modules & widgets - they sound like the same thing.

What would be the best practice way to add a Contact Us page - as a layer or a Content Type?

Thanks.

1
For the record I abandoned Orchard it's WAY too complex. Switched to C1 CMS, it's a dream to use and it is free it's only certain power features they charge for, which I've never needed to use. - niico

1 Answers

4
votes
What is the difference & relationship between layers, content types, 
modules & widgets. And why are there no pages?!

Layers control which widgets appear in which zones (designated by the theme) on a particular page. They have rules, so for example, I could have a layer called NotHomePage and give it the rule not url("~/") and any widgets added to zones on that layer would appear everywhere but the home page.

Content types are just that--types of the content you create on the site. A Page is a content type you get out of the box with Orchard. It contains a part called Route so one of the first properties you have the option of creating is the slug e.g. mydomain.com/sweet-page.

Modules are basically MVC areas that create specific functionality for a website. A module may contain some custom parts, some script, some styling, etc. There are a couple contact form modules out there, but you'd probably learn more if you used the Custom Forms module that is already cooked in the default Orchard recipe (I think you have to enable it, but it's there.)

Widgets are like code snippets you add to zones (designated by the theme) on a layer where you can have as many widgets as you like. Maybe your home page has a "MainContent" zone where your customer would like to have their tagLine and a small form to sign up for a newsletter. You could add an HTML widget for the tagline (which contains basic information like a WYSIWYG editor for the HTML) and a Custom Form widget (which will handle creating s sign up request.)

Why is TripelFirst a layer for example - not a widget?

TripelFirst should not be a layer, it should be a zone in the TheThemeMachine theme i.e. an area on the page that may or may not contain widgets.

Why can't I just make a 'contact' page and add a widget 
to it called 'Contact Form'?!

You can, but you would need to define a couple things first.

  1. Create a content type called ContactFormRequest (you might need to enable 'Content Types' module)
  2. Add fields (first name, last name, etc) like you would add properties to a class definition
  3. Create a page called Contact with the slug /contact
  4. Create a layer called ContactLayer with the rule url("/contact")
  5. Add a Custom Form widget to ContactLayer and be sure to select ContactFormRequest as the content type
  6. party

This should give you the basic behavior you're looking for. You can, of course, customize this further.

What would be the best practice way to add a Contact Us page - 
as a layer or a Content Type?

Personally, I prefer the flexibility of using my own content type e.g. ContactFormRequest. If, in the future, my customer wants to add height, weight and age as properties to the contact form, I have only to add these fields to the content type and Orchard handles the rest.