× Discussion about "Restaurant" Joomla template

JavaScript Syntax Error

More
5 years 3 months ago #35891 by somedudefred
While trying to resolve why lightbox does not work, my browser's JavaScript console pointed me to a 'syntax error' at this line ... BoxHeights.equalise(,'c2','c3'); ...just after the beginning parentheses.

Is there something missing here in the code? Should it be 'c1'? If yes, where can I edit this code?

Thank you.

Below is the code copied from the page debugger...

<!-- equal heights -->
<script type="text/javascript" src="/hsr/templates/hot_restaurant/js/equal_heights.js"></script>
<script type="text/javascript">
window.onload = function() {
BoxHeights.equalise(,'c2','c3');
}
</script>

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #35902 by ivan.milic
Replied by ivan.milic on topic JavaScript Syntax Error
In index.php of template:

<script type="text/javascript">
window.onload = function() {
BoxHeights.equalise(<?php if($showuser[5]) { ?>'c1'<?php } if($showuser[6]) { ?>,'c2'<?php } if($showuser[7]) { ?>,'c3'<?php } ?>);
}
</script>

change that to:


<script type="text/javascript">
window.onload = function() {
<?php
$tmp = array();
if($showuser[5]) $tmp[] = "'c1'";
if($showuser[6]) $tmp[] = "'c2'";
if($showuser[7]) $tmp[] = "'c3'";

?>
BoxHeights.equalise(<?php echo implode(",",$tmp); ?>);
}
</script>

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #35934 by somedudefred
Thank you for your quick reply!

After switching out the code I ran the debugger again in IE8 and received another error (see attached image).

Just out of curiosity... Which boxes is this script trying to equalize?

Thank you again for your help.
Attachments:

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #35945 by ivan.milic
Replied by ivan.milic on topic JavaScript Syntax Error
Can you check then in IE debugger if this file loads:

templates/hot_restaurant/js/equal_heights.js

That happens only for IE8 ?

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #35951 by somedudefred
Hello Ivan.

I did not see that line of code loading in the 'View Page Source'. I have attached an image to show every line of code where 'script' appears in the head tag.

No. This also happens in Chrome and Firefox.

Any suggestions?

Thank you Ivan.
Attachments:

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #35960 by ivan.milic
Replied by ivan.milic on topic JavaScript Syntax Error
Can you confirm you have this code in index.php of template:

<!-- equal heights -->
<script type="text/javascript" src="<?php echo $template_path ?>/js/equal_heights.js"></script>


it goes just above code you did modify, maybe you accidentally removed it???

Please Log in or Create an account to join the conversation.

Moderators: milos
Time to create page: 0.144 seconds