Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-17 23:02:21

sedated
Member
Registered: 2006-10-17
Posts: 11

How do I do random testimonials?

Hey folks.

I am still wrapping my head around all that is Textpattern and I came across something I wanted to do that I am unsure of.

We have a sidebar on our site and we want to place random customer testimonials in it. They are usually only one sentence long so nothing drastic. I was wondering what would be the best way to do it.

Any help would be much appreciated.

Thanks!

Offline

#2 2006-10-17 23:36:51

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: How do I do random testimonials?

very simple! create a section called ‘testimonials’ and post your testimonials in that section … then make a form to display it as you’d like… could be as basic as just a <txp:body /> tag

then in your page template:
<txp:article_custom form="testimonial-form" limit="1" section="testimonials" sortby="rand()" />

do something similar here: http://www.seecroatia.net

note: this is for 4.0.3 …

Offline

#3 2006-10-17 23:36:55

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: How do I do random testimonials?

You could create a section, <samp>testimonials</samp>, set it to “No” on all the option (display on front page, syndicate), then use this:

<code>
<div id=“sidebar”>
<txp:article_custom form=“testimonials” limit=“1” section=“testimonials” sort=“rand()” />
</div>
</code>

<small>Outposted! :)</small>

Last edited by jm (2006-10-17 23:38:57)

Offline

#4 2006-10-18 21:18:59

sedated
Member
Registered: 2006-10-17
Posts: 11

Re: How do I do random testimonials?

Thanks for the help.

I figured it was something pretty easy.

Offline

#5 2006-10-18 23:11:17

sedated
Member
Registered: 2006-10-17
Posts: 11

Re: How do I do random testimonials?

Actually I have one more question guys.

Is there any way to add a custom class to the articles so it isn’t using the default <p> class?

Offline

#6 2006-10-19 01:23:29

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: How do I do random testimonials?

you could turn textile off when creating testimonials… under ADVANCED OPTIONS / ARTICLE / LEAVE TEXT UNTOUCHED

or if you can uniquely identify <p> tags within your testimonial block, you could use css to remove all padding etc from the paragraph tag

e.g. div.testimonials p {padding:0;margin:0;}

Offline

#7 2006-10-19 01:34:37

sedated
Member
Registered: 2006-10-17
Posts: 11

Re: How do I do random testimonials?

Thanks nardo. I am still learning the features/limitations of Textpattern and appreciate the help.

Offline

Board footer

Powered by FluxBB