Can someone spot the syntax error in this snippet?

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
rstuttle
Forum Newbie
Posts: 3
Joined: Sun Feb 08, 2009 3:07 pm

Can someone spot the syntax error in this snippet?

Post by rstuttle »

Hello,

I am trying to setup a shopping cart and I am getting an error in a module. The error reported is:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in modules.php on line 173

The third line in the code snippet below is line 173 and if the entire snippet is removed from the code, the problem disappears. Unfortunately, removing the code is not a desirable solution. Can someone point out the problem to me? Thank you.

Code: Select all

     if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
        if ($module->check() > 0) {
          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . ''">' . "n";
        } else {
          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "n";
        }
      } else {
        echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . ''">' . "n";
      }
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Can someone spot the syntax error in this snippet?

Post by Weirdan »

With proper highlighting you can see the error yourself, I guess.
rstuttle
Forum Newbie
Posts: 3
Joined: Sun Feb 08, 2009 3:07 pm

Re: Can someone spot the syntax error in this snippet?

Post by rstuttle »

Thanks for the quick reply, Weirdan.

I do wish I could see the error, but I am not a php programmer. I assume that the error has to do with misplacement of quotes, but I am too ignorant of php syntax to see what is wrong. I am hoping that someone who is conversant with php can point out the obvious to me.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Can someone spot the syntax error in this snippet?

Post by Mark Baker »

Code: Select all

 
echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . '">' . "\n";
 
I'm assuming that the "n" at the end should be "\n"


Look at the difference in colouring between your line 3 and the above
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: Can someone spot the syntax error in this snippet?

Post by Ziq »

Code: Select all

 
if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
        if ($module->check() > 0) {
          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . '">' . "n";
        } else {
          echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "n";
        }
      } else {
        echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . '">' . "n";
      }
 
rstuttle
Forum Newbie
Posts: 3
Joined: Sun Feb 08, 2009 3:07 pm

Re: Can someone spot the syntax error in this snippet?

Post by rstuttle »

Your English is fine, and your php excellent!
Thank you!
Post Reply