Jump to content

Help me - Parse error: parse error, expecting `T_VARIABLE' or `'$''


arunkr

Recommended Posts

echo "</select></td>\r\n  </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Views Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_views\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_views').val('');$('#ad_total_views').attr('disabled','disabled');}else{$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');$('#ad_total_views').focus()}\" />Unlimited</label></td>\r\n          </tr>\r\n            \r\n            <tr>\r\n              <td align=\"right\">Total Clicks  Allowed:</td>\r\n              <td><input type=\"text\" id=\"ad_total_clicks\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_clicks').val('');$('#ad_total_clicks').attr('disabled','disabled');}else{$('#ad_total_clicks').val('');$('#ad_total_clicks').removeAttr('disabled');$('#ad_total_clicks').focus()}\" />Unlimited</label></td>\r\n          </tr>\r\n        </table></td>\r\n  </tr>\r\n    <tr bgcolor=\"#FFFFFF\">\r\n    <td class=\"td_th\" align=\"center\">Smarty Code (Developer)</td>\r\n    <td>{\$ads->getAdCode(<span id=\"smartycode\">1</span>)}</td>\r\n  </tr>\r\n    <tr bgcolor=\"#FFFFFF\">\r\n      <td class=\"td_th\" align=\"center\"> </td>\r\n      <td><input type=\"button\" value=\"Create New Campaign\" onclick=\"new_ad()\" /></td>\r\n    </tr>\r\n    </TBODY></TABLE>\r\n<br />\r\n\r\n<TABLE cellSpacing=1 cellPadding=4 width=\"100%\"  border=0>\r\n  <TBODY>\r\n  <TR class=\"td_title\">\r\n    <TD  colSpan=7>Ad Campaigns</TD></TR>\r\n  <TR bgColor=#ffffff>\r\n  \r\n    <TD width=\"10%\" align=\"center\" class=\"td_th\"> </TD>\r\n    <TD width=\"4%\" align=\"center\" class=\"td_th\">ID</TD>\r\n    <TD width=\"29%\" align=\"center\" class=\"td_th\">Campaign Name</TD>\r\n    <TD width=\"12%\" align=\"center\" class=\"td_th\">Start Date</TD>\r\n    <TD width=\"11%\" align=\"center\" class=\"td_th\">End Date</TD>\r\n    <TD width=\"17%\" align=\"center\" class=\"td_th\">Viewed / Views Allowed</TD>\r\n    <TD width=\"17%\" align=\"center\" class=\"td_th\">Clicked / Clicks Allowed</TD>\r\n    </TR>\r\n ";

It's a lot easier to read code if it has syntax highlighting and reasonable indentation.

echo "
  


Total Views Allowed:
Unlimited
          
            
            
              Total Clicks  Allowed:
              Unlimited
          
        
   
    
     Smarty Code (Developer)
     {\$ads->getAdCode(1)}
   
    
       
      
    
    



</pre>
<table cellspacing="1" cellpadding="4" width='\"100%\" ' border="0">
  
  
    Ad Campaigns
  
  
     
    ID
    Campaign Name
    Start Date
    End Date
    Viewed / Views Allowed
    Clicked / Clicks Allowed
    
";</

Okay, yeah, so most of it is red. That's good. But there are some parts that are not. Scroll over to see them.

 

They should be.

 

Using characters like "$(" is okay because PHP knows that "(" can't possibly be part of a variable name. However you can't use "{$(" because that opening { tells PHP that the stuff after the dollar sign is most definitely a variable. Except it isn't. So PHP complains.

 

As Jake said: escape the $s.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.