Hey, I tried searching through the sea of error messages on here, but nothing quite fits my particular issue.
After adding some javascript (a SurveyMonkey widget) through the UI on the website settings tab in one of the text boxes I can no longer access anything admin based - I just get a blank page and a server 500 error. I don’t have a backup of the database before this was added so I can’t do a restore.
I’m getting this:
[Tue May 23 14:55:29.914819 2017] [:error] [pid 3678] [client 192.168.20.69:42734] PHP Fatal error: Smarty error: [in core:common/headerHead.tpl line 20]: syntax error: unrecognized tag: h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments) (Smarty_Compiler.class.php, line 446) in /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php on line 1094, referer: https://ijpds.org/
Can’t see where there’s a syntax error though.
I can’t remember which field exactly, it may have been one of the “about” ones. The javascript worked fine when it was added to any of the static pages though.
It was here: lib/pkp/templates/common/headerHead.tpl - I was looking at the version in my theme.
Odd though, as the code I removed had been there for a while and the site worked fine - that code was for analytics via HotJar - it never worked on the website, but it didn’t break the site either. I must have forgotten to remove it. The site stopped working however when I added javascript in one of the fields in the “information” tab under website settings via the UI. That code was nowhere to be found when I went back in after getting everything working again though.
Something probably triggered a recompile of your templates that surfaced a syntax error in the modified template file. The most likely cause of this is inclusion of e.g. Javascript code in a Smarty template without escaping – Smarty uses { and } characters for its own syntax, and since Javascript also often uses these, it’s common to have to escape them e.g. using Smarty’s {literal} tag before they’ll work.
Regards,
Alec Smecher
Public Knowledge Project Team