DJ_AM_Juicebox
asked on
correct javascript + php syntax, easy
Hi,
I've got a PHP file, and I want to create an include path using a php variable. Right now I have this:
<script type="text/javascript" src="$mainframe->getCfg('l ive_site') /$tiny_url /$tiny_fil e"></scrip t>
It almost works, just the part with:
$mainframe->getCfg('live_s ite')
messes up. When the PHP page is generated, it comes out like:
<script type="text/javascript" src="('live_site')/some_pa th/the_fil e_name"></ script>
I must be missing some quotes or something? I'm a PHP/js novice,
Thanks
I've got a PHP file, and I want to create an include path using a php variable. Right now I have this:
<script type="text/javascript" src="$mainframe->getCfg('l
It almost works, just the part with:
$mainframe->getCfg('live_s
messes up. When the PHP page is generated, it comes out like:
<script type="text/javascript" src="('live_site')/some_pa
I must be missing some quotes or something? I'm a PHP/js novice,
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi guys,
It doesn't seem to be working - my file is indeed a php file, the first line is:
<? php
and the php tag is not closed till the end of the file. Now there is a bunch of php code above my line working fine, but then a strange 'return <<<EOD' statement. Kind of looks like:
<?php
.... some ok php stuff ...
return <<<EOD
<!-- An html comment parsed correctly in the generated page!!! -->
echo "hello" // a basic echo call which fails!!!
?>
I'm not sure what the return <<<EOD statement does, or how the html comment is getting parsed correctly when it is still within the php braces. Anyone have an idea?
Thanks
It doesn't seem to be working - my file is indeed a php file, the first line is:
<? php
and the php tag is not closed till the end of the file. Now there is a bunch of php code above my line working fine, but then a strange 'return <<<EOD' statement. Kind of looks like:
<?php
.... some ok php stuff ...
return <<<EOD
<!-- An html comment parsed correctly in the generated page!!! -->
echo "hello" // a basic echo call which fails!!!
?>
I'm not sure what the return <<<EOD statement does, or how the html comment is getting parsed correctly when it is still within the php braces. Anyone have an idea?
Thanks
ASKER
actually if i put the echo statements before that
return <<<EOD
line, everything works as expected. What is it!
return <<<EOD
line, everything works as expected. What is it!
With out seeing all the code it's hard to tell if the return is php or javascript.
Return returns the product of a function.
function functionname() {
value = 1 + 1;
retrun value;
}
return <<<EOD
looks like bad code maybe it should be:
return '<<<EOD';
echo "hello" // a basic echo call which fails!!!
it should be
echo "hello"; //it needs the ;
Return returns the product of a function.
function functionname() {
value = 1 + 1;
retrun value;
}
return <<<EOD
looks like bad code maybe it should be:
return '<<<EOD';
echo "hello" // a basic echo call which fails!!!
it should be
echo "hello"; //it needs the ;
<?php
echo '<script type="text/javascript" src="'.$mainframe->getCfg(
?>