Jump to content

Template Expression causing Emoticon Loading Error

Featured Replies

Posted

Hi,

I'm using an expression to put the members group Id into a JS variable, which is causing an issue with emoticons from loading.

I've tried pushing the value to the console rather than as a variable and I've also tried renaming the variable as well and the issue still exists, so I feel that it's the actual PHP expression which is causing the issue.

<script>
   var groupId = {expression="\IPS\Member::loggedIn()->member_group_id"};
</script>

This is the error in the console:

Uncaught TypeError: Cannot read property 'length' of undefined
    at baseController._buildEmoji (root_framework.js.1b5af06ae17ee2cabc48118aba3e1865.js.gz:951)
    at baseController.<anonymous> (root_framework.js.1b5af06ae17ee2cabc48118aba3e1865.js.gz:947)

The site is : https://yamahaclub.com/forums/

Any ideas would be most helpful.

Cheers

Edited by asigno
Unfinished sentence

I'm not convinced the error is related to your javascript variable. If you remove your variable does the error actually go away?

  • Author

Hi @bfarber sorry for late repsonse I forgot to tick notifiy me of replies.

Yes if I remove that line code the smilies work fine and I don't get any console errors. I've even created a new default theme and still get the same issue.

If you view the page source for the variable, is it creating a valid value? I'm having a hard time seeing on the surface why that code would cause the error you've supplied.

  • Author

@bfarber Yeah the code is working fine, this is what is rendered

<script>
var groupId = 4;
</script>
              

I thought at first it was just a conflict with the variable name, but on renaming it's the same issue.

  • Author

Hmm. If I switch to the default theme and then switch back to my custom theme the emoji load ok. 

Yeah I can't see any way whatsoever your javascript code would be the problem, particularly if you've tried renaming the variable.

  • Author

Finally found the issue, it was something in tag manager which was only happening when that variable was created. Thanks for your help.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.