ishmell Posted September 22, 2020 Share Posted September 22, 2020 (edited) Hey guys, So when developing modules for my game(s) I keep running into an issue with the TPL html. My projects are using allot of javascript and some of its being called in the html itself inside the modules tpl. I'm currently exploring ways to redefine how the buildElement works to try and create a solution to my ongoing issue but that would require some major changes to the engine which I would like to avoid. I've got css/html inside the tpl that work great but once I start implementing some more advanced javascript that require both " and ' quotations to define elements it basically breaks the html variable placeholder inside the tpl this would break it: <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','../../../themes/ToonCrime/images/ingame/itemslot2.png',1)"> because that also uses those quotations to hold the html information inside of it. $placeholder ''; Now for the time being ive created separate javascript functions for everything I need to do or gone and created php functions in the tpl/inc files to echo or print what I need. Then I call those functions inside the html without defining anything more specific with the ' ' quotes. But using those methods require allot of extra code and is a super inconvenient way of getting something so simple done inside the engine. I'm curious to see what you guys are doing or if you have any suggestions. Edited September 22, 2020 by ishmell Quote Link to comment Share on other sites More sharing options...
Dayo Posted September 22, 2020 Share Posted September 22, 2020 Rather then putting JavaScript in .tpl.php files use .script.js files instead Quote Link to comment Share on other sites More sharing options...
ishmell Posted September 22, 2020 Author Share Posted September 22, 2020 1 minute ago, Dayo said: Rather then putting JavaScript in .tpl.php files use .script.js files instead I am but I'm having to call on a bunch of the javascript in the html design of the modules itself. It's just the nature of my game, there's allot of moving images and changes happening in real time. Quote Link to comment Share on other sites More sharing options...
Dayo Posted September 22, 2020 Share Posted September 22, 2020 Have you tried putting back slashes for the quotes but the template engine uses {} so avoid using them inline 1 Quote Link to comment Share on other sites More sharing options...
ishmell Posted September 22, 2020 Author Share Posted September 22, 2020 Back slashes definitely solve the problem <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image1\',\'\',\'../../../themes/ToonCrime/images/ingame/itemslot2.png\',1)"> Simple solution, Thanks allot Dayo! 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.