Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-02-15 22:30:21
- b-monkey
- New Member
- Registered: 2009-08-03
- Posts: 5
Looking for a "Random quotes" solution
Hi,
Does anyone have any ideas of how to make this work:
http://img718.imageshack.us/img718/9548/quotes.jpg
The box would show a quote from a random client. Text and client parts could be imported from an article, text file etc. The only thing is that although they are randomly selected, text should always match its client (be from the same article).
Thanks
Offline
Re: Looking for a "Random quotes" solution
b-monkey wrote:
The box would show a quote from a random client.
smd_random_text might be able to help you. It can read stuff from just about anywhere you have stored quotes. As long as they’re in a defined format / delimited in a known way, the plugin should be able to choose one or more. And if you need to pick multiple quotes from the same article/source, check out the item_num
attribute (example 7 in the pluigin’s help gives a convoluted but practical use case). Hope that helps.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2010-02-15 23:24:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Looking for a "Random quotes" solution
Please don’t think I’m trying to keep people away from Stef’s plugins ;) but what’s wrong with
<txp:article_custom section="quotes" limit="1" sort="rand()" />
Offline
Re: Looking for a "Random quotes" solution
Els wrote:
what’s wrong with
<txp:article_custom section="quotes" limit="1" sort="rand()" />
Good point. If the quotes are in their own section then that’s the best way to go by far. Heck, any excuse not to install my suspect code is a bonus :-)
I did, however, read the request such that the quotes might be part of an article — marked up somehow — or in a separate file, in which case the plugin might be the only way to do it outside of some PHP. Dunno, you got me wond’rin if I read the OP correctly now…
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2010-02-15 23:31:26
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Looking for a "Random quotes" solution
Bloke wrote:
I did, however, read the request such that the quotes might be part of an article — marked up somehow — or in a separate file, in which case the plugin might be the only way to do it outside of some PHP. Dunno, you got me wond’rin if I read the OP correctly now…
No, you make me wonder if I read it correctly… ;)
Offline
#6 2010-02-16 08:44:11
- b-monkey
- New Member
- Registered: 2009-08-03
- Posts: 5
Re: Looking for a "Random quotes" solution
Els wrote:
Please don’t think I’m trying to keep people away from Stef’s plugins ;) but what’s wrong with
<txp:article_custom section="quotes" limit="1" sort="rand()" />
Wow, why didn’t I think of such a simple solution?
This worked great if I insert each quote as an article:
<txp:article_custom section=“quotes” form=“quotes” limit=“1” sort=“rand()” />
Thank you both for your time and help! :)
Last edited by b-monkey (2010-02-16 08:46:46)
Offline