By Daitaka on
I'm trying to develop a text filter that will replace a [roll] tag with a randomly generated number.
My problem is that, for a given tag, the number should only be generated once. Now, I can figure out a way to do this when people use the Post button, but I'm having trouble handling the Preview functionality.
Since Preview doesn't store anything in the database (that I know of) I'd need some other way to store the data AND bind it to a specific tag in a specific piece of text that isn't even in the database yet...
Does anyone have any ideas on how I could go about this? Or perhaps suggestions for other ways to achieve something similar?
Comments
...
How?
Change the tag to a unique
Change the tag to a unique identifier, store the random number in the database with that unique identifier, perhaps also store what node it belong to, something like that. Once the node and it's text are stored in the db, you can link to it in various ways, but as long as it only exists in (pre-)previews, it's...
I'm guessing that storing it in the $_SESSION will be the only way to do it, I'll just have to inform people they can't write two posts at the same time.