adammde Posted July 16, 2008 Share Posted July 16, 2008 Hi, I'm sure this is stupidly easy, hope someone can help :) I want to put some Javascript inside the define() function of includes/languages/english/index.php, but because the stop character is ; for both JS and PHP, I can't directly, and I don't think I can nest the echo function inside define(). I have linked to some separate JS files which works fine, but I really don't want another file just for three lines of JS unless I have to. Any ideas? Thanks, Adam Link to comment Share on other sites More sharing options...
adammde Posted July 17, 2008 Author Share Posted July 17, 2008 As a temporary workaround I put the (now two) lines of JS into a seperate file and linked to it with <script> inside define(), however performance of the script has gone down the toilet completely, no idea why doing it that way makes such a difference. Here's what I'd like to do: define('TEXT_MAIN', ' <p> <ul id="home_fade" class="crossfade transition-crossfade"> <li><img src="images/home_fade_dive.jpg" /></li> <li><img src="images/home_fade_gun.jpg" /></li> <li><img src="images/home_fade_hp.jpg" /></li> </ul> </p> <script type="text/javascript" src="includes/js/prototype.js"></script> <script type="text/javascript" src="includes/js/effects.js"></script> <script type="text/javascript" src="includes/js/fastinit.js"></script> <script type="text/javascript" src="includes/js/crossfade.js"></script> <script> Crossfade.setup({autoLoad:true}); var cf1 = new Crossfade('home_fade', {autoStart:true}); </script> This is a default setup of osCommerce Online Merchant............ But of course the PHP parser throws up errors when it reaches the ; I'd really love to find a solution - anyone any ideas? Thanks, Adam Link to comment Share on other sites More sharing options...
♥FWR Media Posted July 17, 2008 Share Posted July 17, 2008 Use here-doc whenever you have problems like this .. $mytextjs = <<<TEXTJS <p> <ul id="home_fade" class="crossfade transition-crossfade"> <li><img src="images/home_fade_dive.jpg" /></li> <li><img src="images/home_fade_gun.jpg" /></li> <li><img src="images/home_fade_hp.jpg" /></li> </ul> </p> <script type="text/javascript" src="includes/js/prototype.js"></script> <script type="text/javascript" src="includes/js/effects.js"></script> <script type="text/javascript" src="includes/js/fastinit.js"></script> <script type="text/javascript" src="includes/js/crossfade.js"></script> <script> Crossfade.setup({autoLoad:true}); var cf1 = new Crossfade('home_fade', {autoStart:true}); </script> This is a default setup of osCommerce Online Merchant TEXTJS; define('TEXT_MAIN', $mytextjs); Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
adammde Posted July 17, 2008 Author Share Posted July 17, 2008 That's fantastic, thanks so much for the help :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.