Unexpected & (probably a noob question)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryank
Forum Newbie
Posts: 11
Joined: Sat Jul 19, 2008 2:56 pm

Unexpected & (probably a noob question)

Post by ryank »

I am trying to modify one of the links in a php file to point to a different website profile etc etc. This is a syntax error so I didn't really think too many details would be necessary. When I inserted this link to do the trick I got an "Unexpected & error" on that line. Do you see anything wrong with it?

Code: Select all

<a href = "<?php echo $fbConfig['cb_profile'] ? sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&Itemid=' . $cbitemid . '&tab=getforumtab&fbunsubthread='.$thread) : sefRelToAbs(JB_LIVEURLREL . '&func=myprofile&do=unsubscribeitem&thread='.$thread);?>">
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Unexpected & (probably a noob question)

Post by ghurtado »

I'm pretty sure the error is not in the code that you pasted. It is possible that it is in the "sefRelToAbs" function. Can you paste the whole error message you receive?
ryank
Forum Newbie
Posts: 11
Joined: Sat Jul 19, 2008 2:56 pm

Re: Unexpected & (probably a noob question)

Post by ryank »

Parse error: syntax error, unexpected '&' in /home/anned/public_html/components/com_fireboard/template/default/view.php on line 333

That is the exact error message I receive. Here is the code of the file in it's entirety. Oddly enough line 333 is blank
ryank
Forum Newbie
Posts: 11
Joined: Sat Jul 19, 2008 2:56 pm

Re: Unexpected & (probably a noob question)

Post by ryank »

Hrmm I tried to put the code in and it kept appearing as a blank post.....

Code: Select all

<?php
if ($fbConfig['allowsubscriptions'] == 1 && ("" != $my_id || 0 != $my_id))
{
//$fb_thread==0 ? $check_thread=$catid : $check_thread=$fb_thread;
$database->setQuery("SELECT thread from #__fb_subscriptions where userid=$my_id and thread='$thread'");
$fb_subscribed = $database->loadResult();
 
if ($fb_subscribed == "") {
$fb_cansubscribe = 1;
}
else {
$fb_cansubscribe = 0;
}
}
[b][color=#FF0000]//THIS IS LINE 333 IN THE FILE[/color][/b]
if ($my_id != 0 && $fbConfig['allowsubscriptions'] == 1 && $fb_cansubscribe == 1)
{
?>
<a href = "<?php echo sefRelToAbs(JB_LIVEURLREL.'&func=post&do=subscribe&catid='.$catid.'&id='.$id.'&fb_thread='.$thread);?>">
<?php echo $fbIcons['subscribe'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['subscribe'] . '" border="0" title="' . _VIEW_SUBSCRIBETXT . '" alt="' . _VIEW_SUBSCRIBETXT . '" />' : _VIEW_SUBSCRIBE; ?></a> <b>Subscribe</b>
 
<?php
}
 
if ($my_id != 0 && $fbConfig['allowsubscriptions'] == 1 && $fb_cansubscribe == 0)
{
?>
 
<a&nbsp;href&nbsp;=&nbsp;"<?php&nbsp;echo&nbsp;$fbConfig['cb_profile']&nbsp;?&nbsp;sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&Itemid='&nbsp;.&nbsp;$cbitemid&nbsp;.&nbsp;'&tab=getforumtab&fbunsubthread='.$thread)&nbsp;:&nbsp;sefRelToAbs(JB_LIVEURLREL&nbsp;.&nbsp;'&func=myprofile&do=unsubscribeitem&thread='.$thread);?>">
<?php echo $fbIcons['unsubscribe'] ? '<img src="' . JB_URLICONSPATH . '' . $fbIcons['unsubscribe'] . '" border="0" title="' . _VIEW_UNSUBSCRIBETXT . '" alt="' . _VIEW_UNSUBSCRIBETXT . '" />' : _VIEW_UNSUBSCRIBE; ?></a> <b>Unsubscribe</b>
 
<?php
}
?>
 
Post Reply