Unstoppable Domains

Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Spacemail by SpaceshipSpacemail by Spaceship
Watch

adamf

Established Member
Impact
0
Hi All...

I'm trying to add the following line of code into a php script I own but am getting this error when I do:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
/home/used/public_html/cont/Pages.php on line 1065

The problem is with the following code:

oEdit1.cmdAssetManager="modalDialogShow ('/assetmanager/assetmanager.php',640,445);";

I add it into the page along with other code like below:

<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.cmdAssetManager="modalDialogShow
('/assetmanager/assetmanager.php?lang=german',640,445);";
oEdit1.REPLACE("txtContent");
</script>

I believe the problem is with the way my page is set up and the ' inside the ('/assetmanager/assetmanager.php',640,445) part of the code.

The part of the php page which i'm trying to add this code into is a function like below:

function editNav(){
$f ='TRYING TO ADD THE CODE HERE'; }
return $f;

Do you know how I can go about placing the code - oEdit1.cmdAssetManager="modalDialogShow ('/assetmanager/assetmanager.php,640,445');"; - into a function like above?

Any advise you can provide will be much appreciated...

Regards,
Adam
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
it should be :-

PHP:
function editNav(){
$f ='TRYING TO ADD THE CODE HERE';
return $f;}

your return line was not within the function.

Also the text you are trying to return from the function should have it's single quotes escaped so it will look like the following:-



Code:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.cmdAssetManager="modalDialogShow
([B]\[/B]'/assetmanager/assetmanager.php?lang=german[B]\[/B]',640,445);";
oEdit1.REPLACE("txtContent");
</script>

This is because you are holding the whole string in single quotes, when it encounters the first single quote in your as code it thinks you are closing the quotes (then it reopens at your next).

You would have a similar issue if you used double quotes instead due to the string having double quotes in it as well (an alternative would be to have all quotes within the ad content to be double and the whole string enclosed within single (or the other way around either way is fine).
 
Last edited:
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back