Highlighting Text And Bold/underline/italicize
I set up a new forum using phpBB 2.0.22. The highlighting and bold/italics/underline function is not working correctly. On other phpBB forums, if I am writing a paragraph and decide to underline a word for emphasis, I simply highlight that word, click the "U" button up top, and it inserts the underlined tags around the highlighted word, making it underlined. I noticed this forum works that way as well. Unfortunately, my forum does not.
If I highlight a word and then click "U" for underline, it does not insert the underline tags around the word, but rather places the tags at the end of the text. So instead of looking like this:
I am trying to underline some text
it instead looks like this:
I am trying to underline some text [b ] [ /b]
I added spaces in the underline tags in the example so it would show up as tags.
Is there any way to fix this?
Also, I've noticed (on my forum) that if I put the cursor somewhere in my post and attempt to insert an emoticon/smiley, it places the smiley face at the end of the text, and not where I want it. Example. I will post some text below and then go back and place the cursor in between two words and insert a smiley face:
I utterly despise tech stuff because it confuses me. Luckily, there are cool tech people out there to help.
It placed the emoticon properly. On my forum, if I clicked between the words "stuff" and "because" and then clicked a smiley face, here's what it would look like instead of what I intended.
Bold, Italics, Underline Str_replac'd Using The Same Char For Opening And Closing Tags
I want to write a _very_ simple text parser that would replace a
string like:
"This is text with /italics/, *bold* and _underline_."
and generate automatically something like this:
"This is text with <i>italics</i>, <b>bold</b> and <span
class="underline">underline</span>."
I've found a lot of code snippets explaining how to do BBCode, but
BBCode has different opening and closing pseudo-tags. In my example,
the opening and closing tags are the same (either /, * or _). So I
need something slightly more intelligent that would count the number
of /, * or _ tags, see if that number is even or odd and decide
accordingly if it must replace the char with an opening or closing
tag. (I hope my wording makes sense. It's very clear in my head :-D)
How would you implement that? I reckon it can't be hard, but I just
can't figure how to do it right now!
Regular Expression To Underline A Given Word In A Text...
With the sentence :
"Bordeaux est au bord de l'eau"
How to do to underline, for instance, the word "eau" ? without underlining
the substring of "Bordeaux" ?
I don't know how to isolate the word...
My current code :
$text=eregi_replace("(".stripslashes($word_to_underline]).")","<b>