PDA

View Full Version : & into & in thread title


veenuisthebest
01-04-2009, 12:01 PM
When we create a thread in vbulletin with a title like "google & yahoo", it automatically converts into "google & yahoo" as viewed in source.

This saves one 1 xhtml error.

How do we do it?

Thank you

UKBusinessLive
01-04-2009, 12:03 PM
Do you have html enabled in your title field?? Not 100% sure but it looks like this kind of problem :confused:

if not its probably when you Imported some data, have you imported anything lately or converted from one other forum to VBulletin??

veenuisthebest
01-04-2009, 12:09 PM
Do you have html enabled in your title field?? Not 100% sure but it looks like this kind of problem :confused:
I am not sure what you are talking about. What does enabling html have to do with it?

I just want to know, how & is converted to & automatically in thread titles in vb so that I can do the same in my custom script otherwise it gives xhtml error if & is not escaped.

UKBusinessLive
01-04-2009, 12:13 PM
I am not sure what you are talking about. What does enabling html have to do with it?

I just want to know, how & is converted to & automatically in thread titles in vb so that I can do the same in my custom script otherwise it gives xhtml error if & is not escaped.


:o Sorry buddy i thought you had a problem with & replacing & in your forum titles, Now you've explained it a bit better i'll see if i can find out for you:D

veenuisthebest
01-04-2009, 12:17 PM
:o Sorry buddy i thought you had a problem with & replacing & in your forum titles, Now you've explained it a bit better i'll see if i can find out for you:D
ha its okay.. you were just trying to help :D

btw, i think i found the solution. Can anybody confirm if vbulletin uses the same?
http://www.w3schools.com/PHP/func_string_htmlspecialchars.asp

Thanks

Marco van Herwaarden
01-04-2009, 12:38 PM
Yes vBulletin will also use htmlspecialchars() or htmlspecialchars_uni() .

veenuisthebest
01-04-2009, 12:56 PM
Yes vBulletin will also use htmlspecialchars() or htmlspecialchars_uni() .
Thanks for confirming sir.

Btw, I just figured this out and achieved this by using vBulletin input cleaner. I think vb does it like this.

I had the title variable in my script as 'title' => TYPE_STR

I changed it to 'title' => TYPE_NOHTML. This takes care of all those characters being escaped.

Dismounted
01-05-2009, 02:16 AM
TYPE_NOHTML will run the checks as in TYPE_STR, as well as running htmlspecialchars_uni() on the string.

BTW, htmlspecialchars_uni() is not a default PHP function, it is created by vBulletin.