PDA

View Full Version : Illegal characters for optional_description imagearray in Ultimate Fade-in slideshow?



nevdev
08-14-2013, 09:25 AM
1) Script Title: Ultimate Fade-in slideshow (v2.4)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: Are there any characters that should not be used in the "optional_description" element of the imagearray in the Ultimate Fade-in slideshow (v2.4)? Should the description text ideally be transformed by something like the htmlspecialchars or htmlentities functions in PHP?

Beverleyh
08-14-2013, 10:55 AM
I haven't tried personally - I imagine that " (double quote) can't be used for obvious reasons, but I suppose the only sure way is to run a few tests with special characters, either by hardcoding or using htmlspecialchars/htmlentities, as you previously suggested.

jscheuer1
08-14-2013, 01:47 PM
Just about anything that's allowed in ordinary HTML is fine there. Of course you cannot use " without escaping it. Many folks want to put HTML tags in there, and that's fine, but any " characters used inside the outer " characters need to be preceded with a slash:


\"

What is also often done, if you want HTML in there, is change the outer " characters (aka: the delimiters) of the field to ' characters. Then you can have unescaped " inside the description field. But then any ' inside it would need the escape slash.

nevdev
08-14-2013, 03:36 PM
Thank you, Beverley and John, for those tips. I ended up outputting the text from a prior
htmlentities($str, ENT_QUOTES);. Then I threw every bad character I could think of at it and everything survived.

For me, the important HTML link is the image itself, but if I ever do decide to use HTML in the text I'll take out the htmlentities() transformation and just escape the quotes as advised.

Many thanks.