Peter Knight Posted May 6, 2017 Share Posted May 6, 2017 Hi guys I have a simple echo statement as follows echo " <h3 class='uk-accordion-title'> $item->title </h3> " I want to add a script provided by ZOHO which tracks clicks on certain web page objects. <a onclick='$zoho.salesiq.visitor.customaction("Track-signup-button")'> SignUp </a> This would be the resulting code when I add that echo " <a href='#' onclick='$zoho.salesiq.visitor.customaction('$item->title')'> . </a> <h3 class='uk-accordion-title'> $item->title </h3> " When the HML is output, it almost works BUT the variable $zoho gets removed every time. <a href='#' onclick='.salesiq.visitor.customaction('Our Location')'> . </a> <h3 class='uk-accordion-title'> Our Location </h3> Is this a bug with my method or some escaping issue? Thanks Link to comment Share on other sites More sharing options...
tpr Posted May 6, 2017 Share Posted May 6, 2017 $zoho seems to be a js variable but php tries to parse (and fails). Try \$zoho. http://stackoverflow.com/questions/6066315/how-to-escape-javascript-code-that-is-echoed-in-php 2 Link to comment Share on other sites More sharing options...
Peter Knight Posted May 6, 2017 Author Share Posted May 6, 2017 That's it - thanks @tpr I had another small error which is fixed now too. I needed to surround the $item->title in double quotes. Cheers 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now