vendredi 17 avril 2020

Parse error: syntax error, unexpected 'else' (T_ELSE) on line 148 [duplicate]

I am practising my code and am trying to create a website that allows users to input folder names. These folders then show up on the main page if the $folder that they are in is equal to none (if it is not, the folder will appear under that folder as a subfolder). However, when creating this if-else statement, the error: 'Parse error: syntax error, unexpected 'else' (T_ELSE) on line 148'. I have tried moving around the PHP tags, and HTML tags, as well as checking that I have closed all brackets/ tags etc. If I have missed anything or if you know what may be happening, any help is greatly appreciated! Thankyou in advance, and below is the code from which the error is coming from:

`<header>
  <?php if ($folder == none) {
   foreach($shelfitems as $shelfitem): ?>
    <div class="container">
        <div class="row">

              <div class="col s6 m4">
               <div class="card z-depth-0">
                    <img src="listimg.png" class="listing">
                        <div class="card-content center">
                            <h6><?php echo htmlspecialchars($shelfitem['name']); ?></h6>
                              <ul class="grey-text">
                                  <?php foreach(explode(',', $shelfitem['description']) as $ing): ?>
                                  <li><?php echo htmlspecialchars($ing); ?></li>
                                  <?php endforeach; ?>
                              </ul>
                             </div>
                            <div class="card-action right-align">
                           <a class="brand-text" href="details.php?id=<?php echo $shelfitem['id'] ?>">Open Folder</a>
                          </div>
                         </div>
                        </div>
                       </div>
                      </div>
                    } <?php else {
                       exit();
                    } ?>

               </header>
             </div>`

Aucun commentaire:

Enregistrer un commentaire