Orchard Fundamentals

Topics: Administration, Core, Customizing Orchard, General, Writing modules
Nov 27, 2013 at 11:31 AM
Edited Nov 27, 2013 at 11:39 AM
Hello all,

I am beginner to Orchard 1.7. My purpose of starting this discussion is, to make beginners aware about Orchard Fundamentals.

I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "

FYI: I went through the documentation and plural sight's video. But I was not able to clear above fundamentals.

Sorry for any inconvenience or any stupid questions, but at this time it seems bit complex for me. Can anybody please help me to clear my fundamentals of orchard?

Thank you,
Sohil Shah
Nov 27, 2013 at 6:59 PM
What you have done is perfectly right, and usually there are many equally good solution to one problem in Orchard (or there are many solutions each having drawbacks and advantages), as in any framework. A content type for this is justified, as you could also use this functionality in a widget (what would need its own content type too).

Another option would be to just inject a shape into the layout from a filter (where the filter contains the logic for fetching the blogpost), where the shape's template displays what you wish. This is basically a lightweight widget-like solution.

Another option would be to use a Projection Page or Projecton Widget, where you override the necessary shape templates to add the pieces that are missing for you (like the user's profile pic).

Everything I mentioned here is more or less documented in the Documentation. Also there is the <shameless plug>Training Demo module illustrating every mentioned concept too as well as the Dojo Course online course that explains Orchard development from the ground up.</shameless plug>
Nov 28, 2013 at 11:31 AM
Yes, you are right that I can do the same functionality using widget. But let me tell you the details, which I want is from SQL SERVER Database. Is is possible to create widget which takes data from database and display on the front end?
Nov 28, 2013 at 11:37 AM
Sure. A widget can have "code behind" in the drivers of your custom parts (and also you can add new drivers to existing parts) where you can do anything. The same with the "injecting a shape from a filter" technique I mentioned.