Using data in a script

13 posts by 3 authors in: Forums > CMS Builder
Last Post: August 5, 2009   (RSS)

Re: [Roj] Using data in a script

By Dave - August 4, 2009

Roj,

This is a tricky one. Making javascript work is a bit outside of our expertise and support but try adding this function to the top of the page:

<?php
function jsEncode($content) {
$content = htmlspecialchars($content);
$content = addcslashes($content, "\\'\r\n");
return $content;
}
?>


Then use this for your mouseover link:

onmouseover="onover('<?php echo jsEncode( $record['fieldname'] ) ?>')"

And I've attached a test file that shows this working with images and content with single and double quotes.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

By Roj - August 5, 2009

Hi Dave,

That's perfect. Images, links and underline now work fine.

Thanks for your help and a great product.

Al the best Roj
Roj