Ok I have another question for you smart ones out there (in here):
I have this JS code inside PHP code:
echo '
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
var alternateContent = \'something goes here\';
document.write(alternateContent);
// -->
</SCRIPT>
';
Now where it says "something goes here" i need to insert the value of a PHP variable whose value is assigned by a PHP function (see my other post http://www.phpbuilder.com/board/showthread.php?threadid=10277005).
In other words I have a function called menuhtml(); that returns a menu for a site. I need to remove the symbol "|" from it and replace it with "<br>" so I do this:
$menuhtml = menuhtml();
$menuhtml = str_replace('|','<br>',$menuhtml);
At this point I need to put this menu inside the JS variable alternateContent but for some reason it don't work...
I tried:
var alternateContent = \'something '.$menuhtml.'goes here\';
and it doesn't work, but strangely this works:
var alternateContent = \'something '.$var.'goes here\';
where $var is simply a variable with a value assigned like this:
$var = 'value';
I am assuming it's a matter of what is inside $menuhtml and for some reason it won't let me put it inside a JS variable that is then printed from within a PHP echo... I know it sounds complicated and catch22-type but I think it needs to be that way, other that this everything seems to work... it's about flash and non-flash content swapping... so I need to check for flash with JS and then according to result swap content, and since everything is in a PHP file with lots of if statements the entire JS script happens to have to be inside a PHP echo... just so don't think I am crazy... ;-)