Recent Topics

1 Jul 14, 2006 14:33    

Hello Crowd,
I'm thinking about dynamically displaying additional information based on individual posts content; why? Like Wikipedia does for instance, I would like to automagically append or prepend specific disclaimers ("no health counsel", "no legal counsel" etc.) or warnings ("Caution! Explicit language. Don't proceed if you're easily offended ...") etc., according to key terms in the content like "ยง", "health", "s*xual", etc. You get the idea. :-)

To accomplish this, I figure I must parse the content field for a set of terms and then issue the fitting snippet, something like
if {content contains (legalterm1, legalterm2, legalterm3, ...)}
include legal-disclaimer-snippet.php;
if {content contains (healthword1, health2, health3, ...)}
include health-disclaimer-snippet.php;
if {content contains (poo1, offending2, baaad3, ...)}
include foulmouth-warning-snippet.php;

or echo or whatever works best.
Key requirement is the extendable list of trigger terms me thinks. (I also don't know if it would be better to store them in external file/s or hardput them into the individual check statement (in _main.php?).)

Again I don't know enough codish to workably put it together on my own. Therefore any help offered is very much appreciated. :-)

Thanks in advance, looking forward to your postings, with best regards,

'lex

2 Jul 14, 2006 15:34

I think this could be done with a plugin in 1.8-beta. Check out some of the renderer plugins that come pre-installed. They basically do a search and replace on post content. But, you could also search post content and if you find your phrase, change the post content to include your message.

3 Jul 14, 2006 15:44

Hello Personman,

I'm running 0.9.2 yet.

But, you could also search post content and if you find your phrase, change the post content to include your message.

Any quick example how I would best code some suchness?

thx! :-) 'lex

4 Jul 14, 2006 15:45

In 0.9.2? No, I can't give a quick example of how to do it for that version. I've never really messed with the plugin system for it because it can't do nearly as much as the new one. I would upgrade if I were you.

5 Jul 14, 2006 16:35

The smilies plugin works kinda the way you want. It looks at the post content and if it sees something it knows is supposed to be a smilie it replaces it. You want "if it sees something it knows is a keyword it adds a warning to the top" but the method is pretty similar. The "read more" function works the same way, but it's not a plugin.

Hopefully that'll get you started, as most folk who are into doing the hackage thing have jumped on 1.8 like a crazed band of crazy people jump on whatever it is crazy people would jump on. That's a *terrible* analogy, but you probably get the idea.

6 Jul 15, 2006 08:49

Hello,
@personman: Hm, is 1.8 "safe for production"? I learned that it's always "best practice" to go with the higest "stable" release?
But, assumed I upgrade:
- is it much trouble to go from 0.9.2 to 1.8?
- to alter 0.9.2. skins to 1.8 format?

@EdB:
Thanks for the hint/s. I'll check that out. Hope I remeber that bit about activating plugins that I've read somewhere here ;-)

L8rs,
'lex

8 Jul 15, 2006 12:51

Lexagon you might want to stick with where you're at AND throw down a second installation for "Summer". That way you can work your skin up to that level and tinker with a renderer plugin without losing your blog. Summer is pretty good, but there are a couple of known issues that will be in the 1.8.1 package. When that hits the streets you can rest assured of not finding those few issues when you do move up.


Form is loading...