Forum Moderators: coopster

Message Too Old, No Replies

T_encapsed_and_whitespace?

I'm just new and lost.... I can't find my problem

         

jenidralph

12:39 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



I am very new at this and I am receiving the error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ftphome/tzer.org/components/com_comprofiler/comprofiler.html.php on line 485

This is line 485 (it is long)... any help would be greatly appreciated.

echo "\n\t</td></tr></table><table><tr><td><img src=".$bimage."></td></tr><tr valign=\"bottom\" width=100%><td valign=\"bottom\"><?php if($my->id==$user->id && $ueConfig['allowBpic']==1 && ($ueConfig['allowBpicUpload']==1 ¦¦ $ueConfig['allowAvatarGallery']==1)) { echo "<a href=".sefRelToAbs($ue_userbpic_url)."><img src='".$adminimagesdir."updateprofile.gif' border=0 /> "._UE_UPDATEBPIC."</a>";?></td><td valign=\"bottom\"><?php if($user->bpic!='' && $user->bpic!=null) echo "<a href='".sefRelToAbs("index.php?option=com_comprofiler&Itemid=".$Itemid."&task=userBpic&do=deletebpic")."'>"._UE_DELETE_BPIC."</a>"; }?></td></tr></table>";

dreamcatcher

2:13 pm on Apr 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi jenidralph, welcome to Webmaster World. :)

If you don`t mind me saying so, thats one messy block of code. LOL! You have if statements and echo`s and PHP tags inside a echo statement. Any one of these things will give you an error.

dc

jenidralph

8:31 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



I know, it was a copy/paste from the original code (to attempt to duplicate something on the page)... I don't know where to begin to fix this.

mcibor

9:07 pm on Apr 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It should be like this:
<table>
<tr>
<td><img src="<?php echo $bimage;?>"></td>
</tr>
<tr valign="bottom" width=100%>
<td valign="bottom">
<?php if((($my -> id) == ($user -> id)) && ($ueConfig['allowBpic'] == 1) && (($ueConfig['allowBpicUpload'] == 1) ¦¦ ($ueConfig['allowAvatarGallery']==1)))
{?>

mcibor

9:09 pm on Apr 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And here the last part. Sorry for splitting, but I can't post it here otherwise.
<a href="<?php echo sefRelToAbs($ue_userbpic_url);?>">
<img src="<?php echo $adminimagesdir;?>updateprofile.gif" border=0 />
<?php echo _UE_UPDATEBPIC;?></a></td>
<td valign="bottom">
<?php if(($user->bpic!= '') && ($user->bpic!=null))
?>
<a href="<?php echo sefRelToAbs("index.php?option=com_comprofiler&Itemid=" .$Itemid. "&task=userBpic&do=deletebpic");?>"><?php echo _UE_DELETE_BPIC;?></a>
<?php
}
?>
</td></tr></table>

Much easier to read, don't you think?
Michal Cibor

PS In the if clause you should use more brackets, because why do you assume, that == is done after && and not otherwise?
Best regards

jenidralph

9:57 pm on Apr 21, 2005 (gmt 0)

10+ Year Member



The original error is gone, but now it is saying unexpected '?' in this line and I've tried to fix it, but apparently I'm an idiot.

<td><img src="<?php echo $bimage;?>"></td>

mcibor

8:58 pm on Apr 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you have some previous code, it should look like:

<?php
//some code

?>
<td><img src="<?php echo $bimage;?>"></td>

It means, that you cannot have an opening of php inside a php (there's a specialistic word for that, but i forgot it). It means that you can't do what you can do with ifs:

if($a = 1)
{
if($a!= 0)
{
}
}
With <? you can't do that.
Best regards
Michal Cibor