I am very new to Orchard CMS and I am working on trying to create a testimonials page in my project.
I have created a content type that holds a body, textfield (TestimonialBy), and tags (for SEO purposes) called Testimonial. Now I need to create a page that will roll up all of my testimonials onto it.
I can create the content for the testimonial, and it is visible via navigating to the testimonial URL, however what I need to do now is create a testimonal page (localhost/testimonials) that will take AL开发者_如何学运维L published testimonials and roll them up on one page so I could have:
Testimonial 1 content -name of test giver
Testimonial 2 content -name of test giver
etc
My question is, how do I do this?
You should create a content type like you've already done with the following parts:
- Title Part (if you want it to have a title)
- Autoroute Part (if you want it to have its own URL)
- Body (for content)
- Tags
Then enable the projector module.
Then create a query that lists your new content type.
Then create a new projection (or you can also use a projection widget) to show the content items returned by the query.
Updated for Orchard 1.4+
You should start by reading the documentation at Orchard Project, specifically the 'Extending Orchard' section which shows you how to create your own modules and content parts.
You could approach this in a few ways - one would be just edit the HTML of the page that has the testimonials and this is by far the quickest an easiest.
Another way might be to create a testimonial widget that lets you enter a name, quote, description etc. on the widget editor. You could then create a layer with the page's URL as part of the rule and just add widgets to the content zone. Because the widget would be driven by a content part, you could also add testimonials to your pages, blogs, custom content types etc.
Another way might be to write a controller for the admin interface that lets you do CRUD for testimonial records. You could then write a content part which lists these. You can then add this content part to a page, widget etc and with a bit of work add options so that you can control the testimonials that are shown on a per-content part basis.
Ultimately there are many ways to do this sort of thing in Orchard, it just depends on what you need and how much time/effort you want to put in to it.
Hmm. Sounds very close to a blog post. You might be able to create a testimonials blog and fill out the posts with the testimonial content.
Or u could add the containable part to the testimonial contentType and add the testimonials to the list.
Hope that helps
Dan
精彩评论