Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

error 500

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
salman20054
Smarty n00b


Joined: 27 Jul 2019
Posts: 3

PostPosted: Sat Jul 27, 2019 6:07 pm    Post subject: error 500 Reply with quote

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
View user's profile Send private message
bsmither
Smarty Pro


Joined: 20 Dec 2011
Posts: 245
Location: West Coast

PostPosted: Sat Jul 27, 2019 8:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
bsmither
Smarty Pro


Joined: 20 Dec 2011
Posts: 245
Location: West Coast

PostPosted: Sat Jul 27, 2019 9:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
salman20054
Smarty n00b


Joined: 27 Jul 2019
Posts: 3

PostPosted: Sun Jul 28, 2019 4:40 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Sun Jul 28, 2019 6:44 am    Post subject: Reply with quote

Inserted which code?
What is no longer available?
Back to top
View user's profile Send private message
salman20054
Smarty n00b


Joined: 27 Jul 2019
Posts: 3

PostPosted: Sun Jul 28, 2019 8:18 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Wed Jul 31, 2019 11:25 am    Post subject: Reply with quote

Wrap your JS code into {literal}{/literal} tags.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP