• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Fred
  • Private: No
  • Open Date: 11.12.19, 17:47
  • Opened by: Sophia Kulakova
  • Closed by: Fred
  • Closed on: 01.02.20, 14:07
  • Reason: No answer from a customer
  • Comment: Glad to help!

Ticket #16431 - The problem with the installation code

Hello. I need to put a metric code on the site to track visitors. However, the topic does not allow. The support team on my hosting called this problem:

PHP Fatal error: Uncaught –> Smarty Compiler: Syntax error in template “file:/home/s/skulakova/amberheart.ru/public_html/themes/alysum/templates/mobile/_partials/footer.tpl” on line 75 “(function (m,e,t,r,i,k,a){m[i]=m[i]||function () {(m[i].a=m[i].a||[]).push (arguments)};” - Unexpected " [ " , expected one of:”}” ←-

thrown in /home/s/skulakova/amberheart.ru/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 75

They say the cause of the problem is a metric code error

<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

   ym(55077997, "init", {
        clickmap:true,
        trackLinks:true,
        accurateTrackBounce:true,
        webvisor:true,
        trackHash:true,
        ecommerce:"dataLayer"
   });
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/55077997" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->

They Copied the source file themes/alyssum/templates/mobile/_partials/footer.tpl in themes/alyssum/templates/mobile/_partials/footer.tpl123. From the source removed this code, starting with line 75, the error disappeared.

Now I need to update this code, but the hosting support service can not help me. You will be able to fix this error and install the code.

Comments

Fred 11 Dec 2019, 17:49

Hi, Sophia.
Try to add literals before the code, like this:

<script type="text/javascript" >
{literal}
   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

   ym(55077997, "init", {
        clickmap:true,
        trackLinks:true,
        accurateTrackBounce:true,
        webvisor:true,
        trackHash:true,
        ecommerce:"dataLayer"
   });
{/literal}
</script>
Sophia Kulakova 11 Dec 2019, 17:50

Strange inserted codes. Error code

[31-Aug-2019 22:37:26 Europe/Moscow] PHP Fatal error:  Uncaught  --> Smarty Compiler: Syntax error in template "file:/home/s/skulakova/amberheart.ru/public_html/themes/alysum/templates/mobile/_partials/footer.tpl"  on line 75 "(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};"  - Unexpected "[", expected one of: "}" <--
  thrown in /home/s/skulakova/amberheart.ru/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 75 
Sophia Kulakova 11 Dec 2019, 17:52

my code metrics which you need to put

<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

   ym(55077997, "init", {
        clickmap:true,
        trackLinks:true,
        accurateTrackBounce:true,
        webvisor:true,
        trackHash:true,
        ecommerce:"dataLayer"
   });
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/55077997" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
Sophia Kulakova 11 Dec 2019, 17:53

I added, it doesn’t help

Fred 11 Dec 2019, 18:07

Please fill out all necessary fields in your profile https://support.promokit.eu/index.php?do=myprofile to access to your server through FTP

Sophia Kulakova 11 Dec 2019, 18:18

used to add literal and nothing worked, now I did as you said and everything worked. Perhaps something has changed in the code itself because of their update. I filled out all the fields. Could you check if I have everything working correctly

Fred 12 Dec 2019, 10:48

All seems ok there

Sophia Kulakova 12 Dec 2019, 10:58

And can I still find out why I have a computer version. rating stars are not displayed. Only the squares are empty.

And Google issues that the site has such errors: Missing field” rating value”; The value specified for the “reviewCount” data item must be positive. Set a value for one of the following data items: “offers”, “review”, or “aggregating”.

Attachments:

Без имени-2.jpg (228.5 KiB)
Fred 03 Jan 2020, 15:23

Hi, Sophia.
Sorry, seems I missed your ticket. We already have a solution, but I need FTP access to implement it