text replacement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

text replacement

Post by s.dot »

my text that replaces smilies looks something like this

Code: Select all

$smileys = array(';-d',';d',';-D',';D');
[php]

For some reason, typing the word "i'd" triggers one of those.  why is that?[/php]
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

;d

I wonder what happens if you entitise something before a d character? Example:

"d

See anything familiar? ;) You might be running the replacement on entitised text (maybe via htmlentities()). May need to undo this, or run the replacement before the text is entitised.

Well, that's my 2c on the possible problem...
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Ah, very good observation.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

scrotaye, I noticed you're quite busy with your smilie thing, as I've seen a few posts about it from you. As I'm also working on implementing smilie replacement in a little script, I was wondering if you would like to share some ideas? The subject of this thread made me aware of the fact I will run into the exact same problem as you did :)
Furthermore, as I have it implemented in my script now, I find it kind of hackery. Everything hardcoded all over the place, inline javascript to insert the smilies, not flexible, etc. So if you would like to share some ideas, snippets of code or have links to good examples, that would be cool.
Post Reply