Jump to content
Sign in to follow this  
ishmell

Module html workarounds

Recommended Posts

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 by ishmell

Share this post


Link to post
Share on other sites

Rather then putting JavaScript in .tpl.php files use .script.js files instead

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Have you tried putting back slashes for the quotes but the template engine uses {} so avoid using them inline 

  • Like 1

Share this post


Link to post
Share on other sites

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!

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...