php var to flash var

A

Anonymous

Guest
Hi there brothers :D I have a java script code that will do this but I wonder if theres a way to do this with php since php doesnt show the code in the source.

This works like a charm, does php have any way to target objects and setVariables?
Code:
<script language="JavaScript" type="text/JavaScript">
window.document.mp3player.SetVariable("mp3url", '/items/<?php echo $row_0["itemType"]; ?>/audio/<?php echo $row_0["itemId"]; ?>.mp3');
</script>
also mabe if some one could teach me how to call java script from php
Code:
<script language="JavaScript" type="text/JavaScript">
function doPassVar(args) {
var mp3 = args.value;
window.document.mp3player.SetVariable("mp3url", mp3);
}
</script>
<?php 
if(mp3 == true){
calljs(doPassVar("'/items/" . $row_0["itemType"] . "/audio/" . $row_0["itemId"] . ".mp3'"));
}
?>
 
:( please help me some one just let me know how to call a java script function :(
 
Hi,

I think javascript is called from html and not from php. If you have a php file and you need to call a function, just close the php block... javascript is executed on the client side. For example, if you want the js code to be executed when the page loads, you use <body onLoad=".."> and so.

You can set variables with php, but not without server interaction (i.e. you need to call the server in some way, submitting a form or clicking a link). Remember php is compiled before execution, so you won't be able to change anything with php without a new compilation...

Regards.
 
Thanks victor123 :)

dam I’m having a terrible problem I want to call some functions but only after PHP allows it to for instance an if question and I got it working for IE but not firefox so I’m screwed in that respect and am trying to find another way maybe with PHP but if your correct I'm probably going to have to redirect the page?newjs=1 or some thing like that and exec it but this is going to be annoying to the visitors ;/
 
Hi,

I think you can do what you are saying... for example:

Code:
<?php

if($var):?>

<?php
else:?>

<?php
endif;
?>

What i was trying to say is that you have to close the php block, but when executing, the if will be processed and output all the info...

Regards.
 
Thanks I was doing it right just it was a firefox bug, i had to remove the name="objectname" and only leave id="objectname" ;/ I dono some dumb firefox setting.
 
Back
Top