This project is read-only.

Using Out of the box Orchard OR creating new Module

Topics: Customizing Orchard
Oct 25, 2012 at 11:38 PM

I am developing a portfolio site where users will be able to showcase their own work as portfolio items and other users will be able to rate it. My requirements might be very basic ones which Orchard might be able to achieve out of the box, but I'm new to Orchard, hence asking these question....

I have 2 requirements...

1). On their personal page, Users will be able to create new Portfolio item and will be able to edit them.  Items will be listed in Summary mode and users will be able to click the title and go to the detail, (same as in Blog Posts summary and detail). Items here are filtered based on logged in user.

2) On home page, all the Portfolio items will be listed, with option for user to sort the items by latest date, User Views and Rating. This display also will be in summary mode but would be different look and feed than in point 1.

I wanted to know whether I should user Orchard out of the box functionality or create a module to achieve this. In other words...

a)... From Orchard out of the box standpoint, I create a Portfolio content type (almost every Content Part I need is available at this point), create a custom form and post it on the site. Also, for display, I use Projection and Query and for User page, I use user filter in query layout and for home page, don't use any filter and sort as needed. Theoretically, this seems to work but being new, I have several challenges in making this work. I'll ask those questions once someone endorses that this is right or wrong way to go. One issue briefly I'm facing is to display projection in Summary mode with 2 different look and feel.

b)... Create my own module, still create Portfolio content type, write handlers/ Views and make the templates myself rather than relying on out of the box form function...  I'm new to module building and I understand handlers and drivers but am new to placement, Shape and Editor Template don't have entire picture in my mind on how it can be done. But I can learn and do it with help :-)...

Can one of experts please advise which way I should go?

Oct 26, 2012 at 1:03 AM

I don't think front-end filtering of projections are possible out of the box atm. (someone, please correct me if I'm wrong). If you go for option a), I think you would have to make a projection for each sort option?

I would most likely go for option b) but still use as much as possible out of the box. Download rating modules etc., use them as references/dependencies to your module and attach the parts to your custom content type in your module (in migrations and your content part), letting you re-use almost everything needed out of the box.

Then you can make custom controllers including custom views to easily meet your displaying requirements. For the sorting options, the admin index view of Orchard.Users could be a good starting point.

Oct 26, 2012 at 1:33 AM

You can filter on querystring parameters using tokens, in projections. Then it's just a matter of building a small html form with a GET method.

Oct 26, 2012 at 5:44 AM
Edited Oct 26, 2012 at 5:45 AM

thanks for your reply.

As I am relatively new to this, I need few clarifications to decipher some of above...

1) If I go for custom controller, should I still be using Projections to make the display work and use customer controller for just sorting? Or do I need to write my own views for display and get for sorting?

2) Another aspect also is that I have to provide users with a Form to be filled to add content item from site itself (not admin). Do I need to build this as well in custom views or can I use in built Custom Forms somehow.... this is very hazy in my mind at this point on how to achieve this. Once I have the form, and if it's not in built custom form, Do I need to write logic to trigger data storing logic for all the content parts?

3) I understand that in Query, I can choose sort criteria and when you go about adding new one, it give you several options to choose from. I'm able to use Date Created criteria and it works fine. In another scenario I am using a View counter module which increases based on user views. I do not find Content part from that module listed in sort options with choices to sort with Total Views property. How should i add it and where so that I get this VIEW option?

4) I'm assuming based on above that I do not need to create any Content Part for portfolio and hence I don't need to create any local tables or storage logic. I'm able to achieve my objective by adding different modules, content parts and fields and I don't need to worry about storing the data. Please confirm if this is correct.

Thanks for your help.

Oct 26, 2012 at 8:45 PM

1) No.

2) Custom forms is built for that sort of scenario. I don't know about the specifics in your case, but it sounds like it should work. No custom logic to write in principle.

3) You may have to build a custom projection sort order.

4) If you can build your content type from existing parts and fields then no, you don't need to code drivers, handlers, etc., or worry about storage.

Oct 26, 2012 at 9:04 PM

Thanks Bertrand for your valuable inputs.

Can you point me to some sample for no 3? Is this same as what I see as bindings in Query module? I see that I can add to that out of the box from PartRecords but all the parts are not visible in choice.

Thanks for your help!!

Oct 27, 2012 at 1:07 AM

Look at the existing sort components that come with projections.

Dec 4, 2012 at 9:37 AM


I am also trying to find a way of displaying blogPosts sorted by view counter,  which is very similar with No 3.

If you find the way, could you share with me ? Of course,  I will also share with you whenever I find it.

Thanks in advance.