Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2011-05-03 10:21:19

MyOtheHedgeFox
Member
From: Russia
Registered: 2010-11-06
Posts: 10
Website

Re: smd_random_text: Pull random items from the TXP environment

Thanks for the quick answer! =)
Could you also add a small example with this point to your plug-in description? IMO, I wouldn’t guess that I can use something like \n%\n as a regex’ed delimiter without caring much about the regular expressions syntax, without having an example in front of the eyes.

Last edited by MyOtheHedgeFox (2011-05-03 10:26:27)

Offline

#32 2011-05-03 11:16:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,726
Website

Re: smd_random_text: Pull random items from the TXP environment

MyOtheHedgeFox wrote:

Could you also add a small example with this point to your plug-in description?

Sure. I’ll make an example up and add it to the help at some point.


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

#33 2011-05-03 15:12:28

MyOtheHedgeFox
Member
From: Russia
Registered: 2010-11-06
Posts: 10
Website

Re: smd_random_text: Pull random items from the TXP environment

Yay!

(a plenty of dancing happy kitties, holding geeky banners and screaming something like “STEF RULEZ LIKE OS/2!”)

Offline

#34 2011-05-03 15:15:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,726
Website

Re: smd_random_text: Pull random items from the TXP environment

MyOtheHedgeFox wrote:

STEF RULEZ LIKE OS/2!”

I’ll take that as a compliment :-)


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

#35 2011-05-03 15:22:37

MyOtheHedgeFox
Member
From: Russia
Registered: 2010-11-06
Posts: 10
Website

Re: smd_random_text: Pull random items from the TXP environment

Well, that is. =) Some old Russian users still think that OS/2 was quite good. Those that met the Fidonet bloom, at least.

Er-r-r, I hope no punishment will follow this off-topic.

Last edited by MyOtheHedgeFox (2011-05-03 15:24:57)

Offline

#36 2012-05-19 05:05:05

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 585
Website

Re: smd_random_text: Pull random items from the TXP environment

Hey Stef, love this plugin. I’m having some troubles getting a new random string on every page reload. Thought it might be asy_jpcache caching the site, but I disabled it and got the same result. I noticed that if I save the article with the tags in it again, I get a new result. Do you think it’s query caching? I emailed my host, waiting to see what they say.

Here’s the page: The 85 Dollar Computer Science Book Title Generator

Offline

#37 2012-05-23 23:39:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,726
Website

Re: smd_random_text: Pull random items from the TXP environment

maruchan wrote:

Do you think it’s query caching?

Probably. I had to turn off Send last modified header on Advanced Prefs to get a random quote on each page refresh, though that does increase bytes served per page so you need to be frugal elsewhere if you want to keep the speed up.

If it’s not that then I don’t know what else it might be, sorry.


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

#38 2012-05-24 02:56:32

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 585
Website

Re: smd_random_text: Pull random items from the TXP environment

Thanks, Stef. I didn’t get anything from changing the header setting, and my host verified that query caching was enabled. I ended up rewriting it as a PHP script (the randomizer) and now I use smd_xml to pull in the script output. :-) I still had to disable asy_jpcache site-wide, but at least the titles aren’t cached any longer. Made me wonder if I could disable asy_jpcache per-article somehow; maybe I’ll look into it.

Last edited by maruchan (2012-05-24 02:57:45)

Offline

#39 2012-12-03 11:48:46

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,464
Website

Re: smd_random_text: Pull random items from the TXP environment

Not surprising that I find a smd_ plugin available for something I need to try. ;)

I’m trying this… It starts out pretty standard procedure; a person clicks a category from a category list, they’re taking to a list of articles for that category. But then, above the resulting list of article titles, I have a short acknowledgement, like this:

“Oh, <txp:category>, eh? You {random string}! Here’s what I have for you…”

The {random string} might pluck things like: “sly dog”, “funky monkey”, “nasty thang”, etc.

Looking back over the thread, it looks like this might be a good way to approach it, as it keeps the various random strings out of the admin-side UI, as a form, article, or whatever.

Does that make sense to try? Something simpler?

Also, I guess you could have two random strings on the same page with each pulling from a different .txt file?

Ed.: Actaully, looking at the docs, it seems a simple string right in the tag might be perfect. I’ll try that and see what shakes.

Ed. 2 Well, that was too easy. ;) Excellent plugin!

Last edited by Destry (2012-12-03 12:36:19)

Offline

#40 2013-09-21 16:50:01

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,464
Website

Re: smd_random_text: Pull random items from the TXP environment

This time I have a real question, as opposed to a false one. I basically want to do something like this with a sentence…

{Random string starter} constant part {random string ender}.

So that each randomization process throws the matching starter and ender strings.

I was thinking maybe the “sync” example in the Help was relevant, and I tried this for variables…

<txp:variable name="starter">Starter 1 | Starter 2 | Starter 3</txp:variable>
<txp:variable name="ender">Ender 1 | Ender 2 | Ender 3</txp:variable>

and then tag setup like…

<txp:smd_random_text type="txpvar" source="starter" limit="1" wraptag="p">
{smd_rnd_txt} constant part <txp:smd_random_text type="txpvar" source="ender" item_num="{smd_rnd_txt_chosen_item}" />.
</txp:smd_random_text>

But that doesn’t seem to work. Nothing outputs.

Not possible?

Offline

Board footer

Powered by FluxBB