We’re using the code snippet provided below (obtained here), but it contains a minor PHP code error (or two) that we can’t quite figure out how to solve.
The error messages we’re getting are:
PHP Syntax Check: Parse error: syntax error, unexpected ‘}’, expecting end of file in your code on line 4 (source)
and
Parse error: syntax error, unexpected ‘}’, expecting end of file in code on line 18 (source)
Any there any PHP experts out there that can tell us how to fix the errors?
There doesn’t appear to be anything amiss with this code, unless there are hidden characters somehow. Do you encounter the same after ensuring the snippet opens with <?php at the beginning?
I didn’t want to bring this up, but the above Code Snippet (now deactivated) was causing Google to flag one of our sitemap URLs, thus impacting our SEO. Note: Sorry, I did not have a chance to screenshot the Google error message.
So, not sure which way to go now unless you know of an alternate code snippet that can achieve what we need. That is … “Scroll to First Error Message” when clicking the SEND button.
Hi Jonathan. I’m not sure why your code is throwing a syntax error exactly, but have you seen this solution that may accomplish the same thing for you?
Thank you for the reference. Yes, we ran into that article (code snippet) this morning.
We replaced ours with the one you referenced. Unfortunately, it partially worked for us.
We submitted our feedback to Gravity Wiz via the comment section of the article. Their response suggests they plan to make some adjustments or enhancements to the code.
As soon as Gravity Wiz can solve or address the issues we identified, we’ll leave the code snippet activated on our site(s).
Perhaps we can leave this topic open until the issues are addressed and/or fixed.