php - !empty statement not getting the response I anticipated -


i have call page , returning photos within javascript slide show, however, needed add message pop if there no photos item.i keep getting error, not quite sure wrong logic..if add

        if(!empty($photo)){           print '<div class="nophoto">there no photos item </div>';      } 

i message if click on item photos message appear brief second,when photos populate slide show.

  <?php    echo '<div class="container">';    foreach($value $photo=>$pictures){     if(isset($_get['photoval'])){       if ($_get['photoval'] == $photo){               if(empty($photo)){              print '<div class="nophoto">there no photos item</div>';             }            else         echo '<div class="flexslider"><ul class="slides">';       foreach($pictures $picture){                                        echo '<li> <img src="photos/'.$picture.'" /></li>' ;               }     echo'</ul></div><a class="close"href="javascript:closewindow();">back map</a>';     }    }   }      echo '</div>';  ?> 

what have (with comments):

   echo '<div class="container">';     foreach($value $photo=>$pictures){      if(isset($_get['photoval'])){ // successful get? yes - continue        if ($_get['photoval'] == $photo){ // variable assignments not require if statement unless have $photo set value          echo '<div class="flexslider"><ul class="slides">';          else if (!empty($photo)){ // don't need "else" here , saying "if photo isn't empty" same saying "if photo have value". don't think want print "there no photos item" when there photo          print '<div class="nophoto">there no photos item</div>';        }        foreach($pictures $picture){                                        echo '<li> <img src="photos/'.$picture.'" /></li>' ;               }     echo'</ul></div><a class="close"href="javascript:closewindow();">back map</a>';     }    }   }     echo '</div>';  ?> 

what sounds trying do:

<?php    echo '<div class="container">'; // write container     foreach($value $photo=>$pictures){      if(isset($_get['photoval'])){ // if photoval proceed        print 'photoval set, if can read text , there no images display need write if statement within scope of if(isset($_get['photoval'])) can load placeholder text. if text doesn't display @ else conditional need placed after if(isset($_get['photoval'])) statement.';        $_get['photoval'] == $photo; // variable assignment        if (empty($photo)) { // if photo empty write no photo string           print '<div class="nophoto">there no photos item</div>';       } else echo '<div class="flexslider"><ul class="slides">';        foreach($pictures $picture){          echo '<li> <img src="photos/'.$picture.'" /></li>' ;               }      echo'</ul></div><a class="close"href="javascript:closewindow();">back map</a>';      } else {           print 'photoval not set =(';     }     }     echo '</div>'; // close container ?> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -