Have a question? Want to hire me? Get in touch with me now!

Create a Testimonials Page in Drupal

I see I get some inadvertent traffic from people searching for how to create a testimonials page in Drupal. Since that's what people want, I'll be glad to tell you how! I'll assume you're somewhat familiar with Drupal 6 and web design, in general, and with the basic concept of installing modules. You'll need to have Drupal 6 Views and CCK installed for this one.

I'll first show you an example of a website I designed that makes use of a testimonials page, along with a block on every page which shows a random testimonial. Check out this website I designed for a Chicago lawyer: www.legacylaws.com and see the testimonial on the bottom left. It randomly displays a different testimonial on page load and links to a page which displays the full list of testimonials.

Here's a screenshot:

Drupal testimonials block screenshot

And here's a shot of the page which will display the full list of testimonials:

Drupal testimonials page

Let's look at the testimonial and see what it's made of. For CCK, we'll need the main quotation field, which we can just use the standard "Body" field, and we'll need the signature - the person who gave the testimonial. Pretty basic!


To create that content type, go to Content Management > Content Types > Add Content Type. Call it testimonials and fill in the fields for submission form settings, too. You can change "Body" to say "Testimonial," if you like.

Then, you'll add a new field, in the "manage fields" section. I called it, "Signed" (which makes sense after it's filled in: Signed: Tevi Hirschhorn). I made a simple text field. I allowed it to be multiple rows, since in my case, people wanted their title and location to appear below their name.

My testimonial content type is attached below as a txt file.

Now let's create the view to display the block and testimonials list page.

Go to Site building > Views > Add and create a new view called "Testimonials." Set the filter to Node: type = Testimonial, and Node: Published = Yes. Set the fields to display to Node: Body, and Content: Signed. Under Sort criteria, set it to Global: Random.

Now, add two displays, one for Block, and one for Page. Here's a screenshot of what we've just done:

In my block view, I overrode the default for "Use pager" and "Items to Display" to "No" and "1" respectively. In order to have my link to the page view on the bottom of the block, I added a "Footer" (and made it Full HTML) for my link.

In the page view, you'll create a path to the page. Make sure it's the same thing you wrote in for the footer link from your block view!

In the page view, I wanted to have a horizontal rule separating each testimonial. There are a number of ways I could have done this: create a custom theme file for this view; edit the css for this specific view, based on view id (a div is created for each row); or, I can insert custom HTML. I had an existing style for horizontal rules in my theme, so I rewrote the output of the signature field, which is the last field in my view to include the HTML. See the screenshot below:

Here's a great tip: you can rewrite the output of fields by either selecting "rewrite the output of this field" on the specific field, or by selecting "exclude from display" and using the field token elsewhere in your view. Pretty cool! If that made no sense, look at the screenshot and you'll see what I mean. Both the body field and signed field are available to use as tokens inside my custom HTML.

Now, you can put your block wherever you'd like in the block administration and testimonials will randomly display.

I've attached the view to the bottom of this post, as well.

Did you find this tutorial helpful? Please post questions or comments below.

AttachmentSize
testimonial content type export3.07 KB
testimonial views export5.33 KB

Comments

this is one of the best explained tuts that i have found for any drupal material. i am so happy that drupal has such contributors to help the community grow. thanks for the post. wishing you all the best for your future.

Thanks Vinod! The strength of Drupal is our great community! I only know what I know because of others' helping hands. :)

I was looking all over the place on Drupal.org to find information about a testimonial module. Found your website with the best explanation because I have my testimonials page working now. I've put it on the backburner for a couple weeks now because reading something new (have used Drupal for only 2 months) makes me dizzy :-) but thanks to your well written informaion I got it to work. Thanks!

Glad you found this tutorial helpful! Thanks for your comments. Drupal can definitely be a dizzying learning experience, but once you've mastered it, you'll love it!

Nicely explained.

I have created the Testimonials View as specified above. After creating the Testimonial I have placed the block in the left side bar, but I am unable to see the link in the left side bar. Kindly let me know how can the link will be displayed in the left menu or anywhere in the page. I also configured the block to display the link for all roles in all pages.

The link (the path you specified for the page view) is created in the "Footer" of the block, instead of as a field or "more" link. You can use any of the those 3 methods, but I chose to use Footer so I can add some HTML around it.

Hey thanks for this informative tutorial short sweet and very clear.
I would just like to find out if you maybe know how I can set up this testimonial in such a way that testimonials will not be post until they have been reviewed.
Thanks again for your time and contribution of knowledge.

Check out the workflow module - you can set the view to only display "approved" testimonials, which can only be set by an admin.

Hey Tevi !

Great tutorial dude ! Thanks a lot for share this informative article. Much needed & useful info for me at this time.

Keep on posting great stuffs like this :)

Just trying out your Testimonial page.

Is there a tutorial for the "Entry" portion of the page (and how that content gets into the DB)?

Thanks!

Jon

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options