New to Orchard...and evaluating...

Topics: Core, Customizing Orchard, Localization, Writing modules
Jan 28, 2013 at 4:36 PM

Hi All,

I am just into Orchard. Though I need to go through a lot of documentation to understand it properly. But i would appreciate if someone can reply my queries so that I know the right path going ahead.

I want to create a new site using which with Orchard & SQL SERVER. To achieve my design goals I need to create a new control which will have its own tables and data. This control will be part of page beside other controls in page. All the pages will include this control (>90% pages). All the pages will support localisation. I have following queries.

1. Does Orchard allows custom control integration.

2. How this control can be mapped with the existing page metadata and structure.

3. What is the best way to achieve this in Orchard.

4. Is there any way by which multiple pages can be created in one go from SQL-Server directly.

5. Is there any document which gives information regarding DB-schema of Orchard.

6. Is there any document which describe how the page information is stored inside DB, which table and which field and what?

7. I don't see anything on SEO/SEM support on Orchard Site. Does Orchard support SEO/SEM and if yes how this works in Orchard.


 

Thanks & Regards.

Jan 28, 2013 at 5:12 PM
Edited Jan 29, 2013 at 1:12 PM

I'll take a shot at answering your Q's, but others will have much better responses than me. 

1. Yes, if you are asking if you can build custom control-like functionality in Orchard. I don't think people use "user controls" in Orchard in the sense of literally building a web forms "Control". Orchard technically does support web forms, so if you need to build this literally as a control, then I'm not sure, but probably, yes to that too. There are many options in Orchard. I have done something similar on my site as what you described. On one of my Orchard sites we have a box on the right side bar that appears on almost every page. It is backed by some database data that is static to the app, as well as some tables that are part of the user's profile once they start using the site. The logic for it is defined in a well contained set of files and dropped into my Orchard theme, similar to how a control would be used. 

2. The question is worded a bit weird, but I think you are asking how you can place the control onto the site, and tell Orchard where to position it? You do this by defining a "Zone" in the Layout.cshtml file of your theme. Then you tell Orchard to render your control in a particular Zone by defining the placement in an xml file called placement.info. 

3. There are many ways, but what I have done when I needed to render a control on most or all pages of a site is to implement a result filter, and override the OnResultExecuting() method, which lets you inject a shape for your control. The shape name matches the name of the shape you "placed" in placement.info, in the previous step. 

4. probably, but i'm not sure exactly what you mean. Can you elaborate what you mean by this? 

5. There is no such document that I'm aware of, but you can look at the Migrations.cs from a specific module, whose functionality you are curious about. The schema is pretty easy to understand.

6. Not that I know of. 

7. Orchard core doesn't support this, but there are free/OSS modules on the gallery that help with this. For example, WebAdvanced.Sitemap lets you build a sitemap.xml to help search engines know what content is on your site. There is also a module, i think called Vandelay Industries, that let's you edit the meta tags for all your content. It's nice because you can attach the MetaTag content part defined in that module onto any existing content item in any other module, such as a blog post, or your custom article pages or whatever, and you'll suddenly have control over meta tags for all those content items. There are other SEO related modules. Check out the Orchard gallery for examples, there is an entire category related to SEO.

Jan 30, 2013 at 2:21 PM

Hi The Monarch,

Thank you for replying. Can you give some more detail steps what and how you implemented the control in your site. 

For point no 4. I mean there are two ways to create pages in any CMS system. Either you use UI and create pages 1 by 1 which is very time consuming. Another is you create pages directly at database level in bulk using some file. Is any there any way we can do such thing in Orchard.

Jan 30, 2013 at 3:15 PM

For point #4, yes, Orchard has an Import/Export feature that allows you to import/export content via XML files. It's easy to use. The best way to learn how to import content is to create some sample data manually in the CMS, and then export it as XML. Look at the XML to see what the structure is you will need to mimic, and then create a similar XML file with the full set of content you want to import. 

For the control there are different ways of doing it. One thing that you want to look into first is using Widgets. With the widget you define the Model, the logic, and the UI in a very straightforward way (look at the docs on orchardproject.net for details). Then you can use Rules to place the widget on particular page(s) within your site. 

I can't remember off the top of my head why I didn't use a widget for what I built, but I'm pretty sure I could have built it that way. But in case you want to know how I did it, I created a class that inherits from FilterProvider and overrode the OnResultExecuting() method. Inside that method I created a shape for my control. I populate it with some data. The "shape" is an object of the C# "dynamic" type, so you can assign arbitrary properties to it on the fly. Then I created a .cshtml Razor template whose file name corresponds to the name I assigned the shape. This Razor template's "Model" is of type dynamic, and the value is the shape I created earlier. I can access all the properties I assigned to the shape from the OnResultExecuting() method. Pretty easy. I think i chose this way because I knew how to do it already, and it seemed like it had fewer moving parts.