MarkRogers Posted November 30, 2013 Share Posted November 30, 2013 Hi all, this is my first post. Be gentle! I'm trying to peform a small hack on a Joomla component to better suit by needs... Currently the 'trigger' has an event attached to it, that opens a browser window, the event looks like this (it works fine): $eventprnt = 'onclick="window.open(\'index.php?myurl ='.$item->id.'\')" '; I want to change the function from 'window.open' to 'window.location.href', but the quotes and semicolons thing is killing me (I keep getting T_STRING errors). I've included an example of one of my attempts to give you all a good laugh: $eventprnt = 'onclick="window.location.href ='$index.php?myurl ='.$item->id.'"'; As you can probably see, I could be here for a while unless I ask for help... I've done a lot of reseacrh, and it sounds like I need backslashes, quotes... All sorts of stuff. Unfortunately it's all Chinese to me. If you can give me a pointer, that would be a real help. Mark Quote Link to comment https://forums.phpfreaks.com/topic/284404-dumb-noob-struggling-with-syntax/ Share on other sites More sharing options...
Solution Ch0cu3r Posted November 30, 2013 Solution Share Posted November 30, 2013 (edited) You need to escape the quotes for the href value $eventprnt = 'onclick="window.location.href =\'index.php?myurl ='.$item->id.'\'"'; Edited November 30, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/284404-dumb-noob-struggling-with-syntax/#findComment-1460763 Share on other sites More sharing options...
MarkRogers Posted November 30, 2013 Author Share Posted November 30, 2013 Thank you, I'll give it a try... I'll probably end up tying myself in knots, but thanks very much. Quote Link to comment https://forums.phpfreaks.com/topic/284404-dumb-noob-struggling-with-syntax/#findComment-1460768 Share on other sites More sharing options...
MarkRogers Posted November 30, 2013 Author Share Posted November 30, 2013 You're a complete star. Much love. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/284404-dumb-noob-struggling-with-syntax/#findComment-1460771 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.