News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Help with installing script into index.template.php

Started by Edi3, November 28, 2014, 10:25:22 AM

Previous topic - Next topic

Edi3

I am trying to install this script into my index.template.php without success as my site keep crashing :/

syntax error, unexpected T_STRING, expecting ',' or ';'

This is the script:

<script src="/cookiechoices.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function(event) {
    cookieChoices.showCookieConsentDialog('Your message for visitors here.',
        'close message', 'learn more', 'hxxp:example.com [nonactive]');
  });
</script>

I would appreciate if someone helps me, please..

Thank you in advance for your time

Arantor


Edi3

i tried on several position in the index.template .. ideally it should be in the very top of the page so i tried immediately after <body> ..

Arantor

If putting it directly after <body>, you need to replace the ' with \' since ' has special meaning in PHP.

Edi3

fantastic - it is working now !

thank you for your help :)

Advertisement: