View previous topic :: View next topic |
Author |
Message |
salman20054 Smarty n00b
Joined: 27 Jul 2019 Posts: 3
|
Posted: Sat Jul 27, 2019 6:07 pm Post subject: error 500 |
|
|
i required help in the following code from ojs
[27-Jul-2019 15:17:31 UTC] PHP Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "core:core:commonheaderHead.tpl" on line 20 "LHCChatOptions.opt = {widget_height:340,widget_width:300,popup_height:520,popup_width:500};" - Unexpected ":", expected one of: "}" <-- |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sat Jul 27, 2019 8:41 pm Post subject: |
|
|
What version of OJS are you running?
I have looked through OJS 3.1.0 and did not find LHCChatOptions.
But it looks like this is a javascript statement. If so, then the statement is not respecting the need to escape Smarty's tag delimiters.
Line 20 will need to be one of:
Code: | LHCChatOptions.opt = { widget_height:340,widget_width:300,popup_height:520,popup_width:500 };
or
LHCChatOptions.opt = {ldelim}widget_height:340,widget_width:300,popup_height:520,popup_width:500{rdelim};
or
{literal}<script>LHCChatOptions.opt = {widget_height:340,widget_width:300,popup_height:520,popup_width:500};</script>{/literal} |
The first is whitespace just inside any braces, the second is using Smarty's tags for braces, and the third is wrapping the <script> block inside Smarty's {literal} tags. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sat Jul 27, 2019 9:02 pm Post subject: |
|
|
I see your post on the OJS forum. Another conversation there in 2017 was wanting to do the same thing - install a "help chat" feature.
Apparently, OJS does not have a dedicated OJS plugin to do "help chat".
Therefore, it is important that any modifications made to Smarty templates as per instructed by the third-party package publisher must conform to the environment they will be used in. |
|
Back to top |
|
salman20054 Smarty n00b
Joined: 27 Jul 2019 Posts: 3
|
Posted: Sun Jul 28, 2019 4:40 am Post subject: |
|
|
just for a try, i had inserted the code in line 20 in headerhead.tpl,
after having a try in front end i opened the file to remove the code/alter the code but the code which i was pasted is no longer available in it.
how can i rectify this error. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jul 28, 2019 6:44 am Post subject: |
|
|
Inserted which code?
What is no longer available? |
|
Back to top |
|
salman20054 Smarty n00b
Joined: 27 Jul 2019 Posts: 3
|
Posted: Sun Jul 28, 2019 8:18 am Post subject: |
|
|
i was inserted chat code from livehelper
Code: | <script type="text/javascript">
var LHCChatOptions = {};
LHCChatOptions.opt = {widget_height:340,widget_width:300,popup_height:520,popup_width:500};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
var referrer = (document.referrer) ? encodeURIComponent(document.referrer.substr(document.referrer.indexOf('://')+1)) : '';
var location = (document.location) ? encodeURIComponent(window.location.href.substring(window.location.protocol.length)) : '';
po.src = '//rubatosis.org/livehelper/index.php/chat/getstatus/(click)/internal/(position)/bottom_Right/(ma)/br/(top)/350/(units)/pixels/(leaveamessage)/true?r='+referrer+'&l='+location;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script> |
after that the code is totally invisible in the line. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Jul 31, 2019 11:25 am Post subject: |
|
|
Wrap your JS code into {literal}{/literal} tags. |
|
Back to top |
|
|