Brenty Posted March 12, 2006 Share Posted March 12, 2006 Hello & HELP!,I'm struggling with some code - I need to set a condition in php, and if this condition is true, then I need to run a java script, which is for a Java menu.This is the condition...[code]<?php if(permission("products","read")==TRUE)[/code]And this is the Java script as I would have called it through HTML...<script src="menu.js"></script><script menumaker src="menu_.js"></script>So how on earth do I combine the 2 together?Please someone help, I'm really trying hard to learn php, and every now and then I hit a wall, like now. Quote Link to comment Share on other sites More sharing options...
keeB Posted March 12, 2006 Share Posted March 12, 2006 [code]<?phpif(permission("products","read")==TRUE) {print "<script src=\"menu.js\"></script><script menumaker src=\"menu_.js\"></script>}?>[/code]Cheers ;) Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted March 12, 2006 Share Posted March 12, 2006 You pretty much wrote it yourself, you might want to check the manual on if statements...[code]<?php if (permission("products","read") == TRUE) { echo '<script src="menu.js"></script><script menumaker src="menu_.js"></script>';}[/code] Quote Link to comment Share on other sites More sharing options...
Brenty Posted March 12, 2006 Author Share Posted March 12, 2006 YAHOOOO! It worked!!!!!!!You guys are life savers! And I've learned just that buit more! Sometimes you're just so near, but so far!Many many thanks! Quote Link to comment Share on other sites More sharing options...
keeB Posted March 12, 2006 Share Posted March 12, 2006 [!--quoteo(post=354350:date=Mar 12 2006, 11:31 PM:name=Brenty)--][div class=\'quotetop\']QUOTE(Brenty @ Mar 12 2006, 11:31 PM) [snapback]354350[/snapback][/div][div class=\'quotemain\'][!--quotec--]YAHOOOO! It worked!!!!!!!You guys are life savers! And I've learned just that buit more! Sometimes you're just so near, but so far!Many many thanks![/quote]Any time.. don't hesitate to ask any more Q's!! [= Quote Link to comment Share on other sites More sharing options...
Brenty Posted March 13, 2006 Author Share Posted March 13, 2006 Well, if someone could take a look at this, it would really get me out of a hole: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=88051\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=88051[/a] 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.