Link to home
Start Free TrialLog in
Avatar of stoneycurtis
stoneycurtis

asked on

PHP syntax error: unexpected end of file

I modified a module on one of my OpenCart (v1.5.5.1) sites and it works fine, I copied those changes to another site and in one template file I have the following code line:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>

Open in new window

Which generates a "syntax error: unexpected end of file on line 162" which is the end of the template file
<?php } ?>

Open in new window

.
I don't understand why I have the error, I'd appreciate any help.
Avatar of ozo
ozo
Flag of United States of America image

You have a { starting a block, with no matching } ending it.
Avatar of stoneycurtis
stoneycurtis

ASKER

Hello ozo,
Adding the closing bracket:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { }  ?>

Open in new window

Breaks the page.
Deleting the opening bracket:
<?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE)  ?>

Open in new window

Breaks the page.
How would I add the closing bracket?
In what way does the page break?
What if you remove the entire line?
Ozo,
By page break I mean the page returns a blank white screen.
Here is the entire code snippet:
<?php $i = 0; ?>
    <?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>    
                <tr>
                    <td class="simplecheckout-customer-left">                       
                    </td>                    
<td class="simplecheckout-customer-right">  
                      <label><input type="radio" name="register" id="myRadio" value="1" <?php echo $register == 1 ? 'checked="checked"' : ''; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" id="myRadio2" value="0"  <?php echo $register == 0 ? 'checked="checked"' : ''; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>
                    
                  </td> 
          </tr> 
               <?php $user_choice = true; ?>
            <?php $i++ ?>           
                   

Open in new window

The code determines if a user is already logged in to his account.
What if I placed
<?php ?>

Open in new window

after
<?php $i++ ?>

Open in new window

If the entire code is
<?php $i = 0; ?>
    <?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>    
                <tr>
                    <td class="simplecheckout-customer-left">                       
                    </td>                    
<td class="simplecheckout-customer-right">  
                      <label><input type="radio" name="register" id="myRadio" value="1" <?php echo $register == 1 ? 'checked="checked"' : ''; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" id="myRadio2" value="0"  <?php echo $register == 0 ? 'checked="checked"' : ''; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>
                    
                  </td> 
          </tr> 
               <?php $user_choice = true; ?>
            <?php $i++ ?>           
<?php } ?>

Open in new window

Then I get no syntax error, just a "Class 'Simple' not found" error
The code is part of a larger file, I've attached it.
ASKER CERTIFIED SOLUTION
Avatar of Rani Sharda
Rani Sharda

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't see an attachment