Criteria toevoegen aan sort-functie?		
			
		
		 		
				
		
                        
                 
            
            
				
                
                    mvdg                       
             
             
                        
                Nieuw lid 
				
				Onderstaande code gebruik ik om de 4 nieuwste mappen van een fotoalbum weer te kunnen geven:
    
    
        
            
                
<?php 
      if (($n_folder = count($mg2->all_folders)) < 1) { echo '<br />No folder'; break; }             
      $mg2->all_folders = $mg2->sort($mg2->all_folders,6,1);      
      for ($i=0;$i<4;$i++)   {  
      echo '<div id="thumbwrapper" class="clearfix">';
      echo "<a href=\"fotoalbum.php?list=".$mg2->all_folders[$i][0]."&page=all\" onmouseover=\"new Tip(this, 'Bekijk het album: ".substr($mg2->all_folders[$i][2],11)."', {delay: '0.0', effect: 'appear'});\">";      
      if (empty ($mg2->all_folders[$i][7])) { echo '<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">'; } else { echo '<img src="gallery/pictures/'.$mg2->all_folders[$i][7].'" alt="" title="" class="thumbfolder">'; };
      echo '<div class="'; 
      if ((time() - $mg2->all_folders[$i][6]) < ($mg2->marknew * 84600)){ echo "infonew"; } else { echo "info"; };
      echo '">';
      echo '<div class="datum">'.substr($mg2->all_folders[$i][2],0,8).'</div>';
      echo '<div class="titel">'.substr($mg2->all_folders[$i][2],11).'</div>';
      echo '<div class="fotograaf">'.$mg2->all_folders[$i][10].'</div>';
      echo '</div></a></div>';  
      }
?>
 
             
            <?php  
 
      if  ( ( $n_folder  =  count ( $mg2 -> all_folders ) )  <  1 )  {  echo '<br />No folder' ;  break ;  }                     $mg2 -> all_folders  =  $mg2 -> sort ( $mg2 -> all_folders , 6 , 1 ) ;       
      for  ( $i = 0 ; $i < 4 ; $i ++ )    {   
      echo '<div id="thumbwrapper" class="clearfix">' ;        echo "<a href=\" fotoalbum.php?list=" . $mg2 -> all_folders [ $i ] [ 0 ] . "&page=all\"  onmouseover=\" new Tip(this, 'Bekijk het album: " . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 11 ) . "', {delay: '0.0', effect: 'appear'});\" >" ;              if  ( empty ( $mg2 -> all_folders [ $i ] [ 7 ] ) )  {  echo '<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">' ;  }  else  {  echo '<img src="gallery/pictures/' . $mg2 -> all_folders [ $i ] [ 7 ] . '" alt="" title="" class="thumbfolder">' ;  } ;        if  ( ( time ( )  -  $mg2 -> all_folders [ $i ] [ 6 ] )  <  ( $mg2 -> marknew  *  84600 ) ) {  echo "infonew" ;  }  else  {  echo "info" ;  } ;        echo '<div class="datum">' . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 0 , 8 ) . '</div>' ;        echo '<div class="titel">' . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 11 ) . '</div>' ;        echo '<div class="fotograaf">' . $mg2 -> all_folders [ $i ] [ 10 ] . '</div>' ;        } 
 
?> 
 
         
     
  
              
        
		
				
		10 antwoorden 
                
                     
                
                    
		
		
	             
 
            
                    
                         
                    
                    
                        
                            Diko (laatste wijziging 03/11/2008 09:01)                             
                         
                     
                    
                        PHP interesse Je kunt voordat je gaat sorteren (line 4) eerst de hele array doorlopen en unsetten wanneer == 1 
    
    
        
            
                
for($c=0;$c<count($mg2->all_folders);$c++) {
  if($mg2->all_folders[$c][1] <> 1) unset($mg2->all_folders[$c]);
} 
             
            for ( $c = 0 ; $c < count( $mg2 -> all_folders ) ; $c ++ )  { 
  if ( $mg2 -> all_folders [ $c ] [ 1 ]  <>  1 )  unset ( $mg2 -> all_folders [ $c ] ) ;  } 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            mvdg                             
                         
                     
                    
                        Nieuw lid Bedankt, hiermee lukt het idd. Onderstaande code doet wat de bedoeling was. Ik heb alleen nog het gevoel dat het een beetje omslachtig is.
    
    
        
            
                
<?php 
      if (($n_folder = count($mg2->all_folders)) < 1) { echo '<br />No folder'; break; }   
      rsort($mg2->all_folders); 
      for($i=0;$i<count($mg2->all_folders);$i++) {  if($mg2->all_folders[$i][1] != 1) unset($mg2->all_folders[$i]); }   
      $mg2->all_folders = array_values($mg2->all_folders);           
      for ($i=0;$i<4;$i++)   {        
      echo '<div id="thumbwrapper" class="clearfix">';
      echo "<a href=\"fotoalbum.php?list=".$mg2->all_folders[$i][0]."&page=all\" onmouseover=\"new Tip(this, 'Bekijk het album: ".substr($mg2->all_folders[$i][2],11)."', {delay: '0.0', effect: 'appear'});\">";      
      if (empty ($mg2->all_folders[$i][7])) { echo '<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">'; } else { echo '<img src="gallery/pictures/'.$mg2->all_folders[$i][7].'" alt="" title="" class="thumbfolder">'; };
      echo '<div class="'; 
      if ((time() - $mg2->all_folders[$i][6]) < ($mg2->marknew * 84600)){ echo "infonew"; } else { echo "info"; };
      echo '">';
      echo '<div class="datum">'.substr($mg2->all_folders[$i][2],0,8).'</div>';
      echo '<div class="titel">'.substr($mg2->all_folders[$i][2],11).'</div>';
      echo '<div class="fotograaf">'.$mg2->all_folders[$i][10].'</div>';
      echo '</div></a></div>';  
      }
?> 
             
            <?php  
      if  ( ( $n_folder  =  count ( $mg2 -> all_folders ) )  <  1 )  {  echo '<br />No folder' ;  break ;  }           rsort ( $mg2 -> all_folders ) ;         for ( $i = 0 ; $i < count
( $mg2 -> all_folders ) ; $i ++ )  {   if ( $mg2 -> all_folders [ $i ] [ 1 ]  !=  1 )  unset ( $mg2 -> all_folders [ $i ] ) ;  }           for  ( $i = 0 ; $i < 4 ; $i ++ )    {         
      echo '<div id="thumbwrapper" class="clearfix">' ;        echo "<a href=\" fotoalbum.php?list=" . $mg2 -> all_folders [ $i ] [ 0 ] . "&page=all\"  onmouseover=\" new Tip(this, 'Bekijk het album: " . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 11 ) . "', {delay: '0.0', effect: 'appear'});\" >" ;              if  ( empty ( $mg2 -> all_folders [ $i ] [ 7 ] ) )  {  echo '<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">' ;  }  else  {  echo '<img src="gallery/pictures/' . $mg2 -> all_folders [ $i ] [ 7 ] . '" alt="" title="" class="thumbfolder">' ;  } ;        if  ( ( time ( )  -  $mg2 -> all_folders [ $i ] [ 6 ] )  <  ( $mg2 -> marknew  *  84600 ) ) {  echo "infonew" ;  }  else  {  echo "info" ;  } ;        echo '<div class="datum">' . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 0 , 8 ) . '</div>' ;        echo '<div class="titel">' . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 11 ) . '</div>' ;        echo '<div class="fotograaf">' . $mg2 -> all_folders [ $i ] [ 10 ] . '</div>' ;        } 
?> 
 
         
     
  
                      
                
                    
                         
                    
                    
                        
                            Kr4nKz1n                             
                         
                     
                    
                        Onbekend Iig is het een zooitje. 
                      
                
                    
                         
                    
                    
                        
                            mvdg                             
                         
                     
                    
                        Nieuw lid Kr4nKz1n  schreef:
Iig is het een zooitje.
  
                
                    
                         
                    
                    
                        
                            Kr4nKz1n (laatste wijziging 03/11/2008 14:55)                             
                         
                     
                    
                        Onbekend Ik zei het nog op een normale manier.Edit niet , niet? , nee niet .
    
    
        
            
                
<?php
If($n_folder = Count($mg2->all_folders) < 1)
{
	echo '<br />No folder';
	break;
}
$mg2->all_folders = $mg2->sort($mg2->all_folders, 6, 1);
For($i = 0; $i < 4; $i++)
{
	echo '<div id="thumbwrapper" class="clearfix">';
	echo "<a href=\"fotoalbum.php?list=".$mg2->all_folders[$i][0]."&page=all\" onmouseover=\"new Tip(this, 'Bekijk het album: ".substr($mg2->all_folders[$i][2],11)."', {delay: '0.0', effect: 'appear'});\">";
	echo empty($mg2->all_folders[$i][7]) ? '<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">' : '<img src="gallery/pictures/'.$mg2->all_folders[$i][7].'" alt="" title="" class="thumbfolder">';
	echo '<div class="'.(time() - $mg2->all_folders[$i][6] < ($mg2->marknew * 84600) ? 'infonew' : 'info').'">';
	echo '<div class="datum">'.SubStr($mg2->all_folders[$i][2], 0, 8).'</div>';
	echo '<div class="titel">'.SubStr($mg2->all_folders[$i][2], 11).'</div>';
	echo '<div class="fotograaf">'.$mg2->all_folders[$i][10].'</div>';
	echo '</div></a></div>';
}
?>
 
             
            <?php 
If ( $n_folder  =  Count ( $mg2 -> all_folders )  <  1 ) { 
	break ; 
} 
$mg2 -> all_folders  =  $mg2 -> sort ( $mg2 -> all_folders ,  6 ,  1 ) ; 
For ( $i  =  0 ;  $i  <  4 ;  $i ++ ) 
{ 
	echo '<div id="thumbwrapper" class="clearfix">' ;  	echo "<a href=\" fotoalbum.php?list=" . $mg2 -> all_folders [ $i ] [ 0 ] . "&page=all\"  onmouseover=\" new Tip(this, 'Bekijk het album: " . substr ( $mg2 -> all_folders [ $i ] [ 2 ] , 11 ) . "', {delay: '0.0', effect: 'appear'});\" >" ;  	echo empty ( $mg2 -> all_folders [ $i ] [ 7 ] )  ? 
'<img src="layout/images/comingsoon.jpg" alt="" title="" class="thumbfolder">'  :  '<img src="gallery/pictures/' . $mg2 -> all_folders [ $i ] [ 7 ] . '" alt="" title="" class="thumbfolder">' ;  	echo '<div class="' . ( time ( )  -  $mg2 -> all_folders [ $i ] [ 6 ]  <  ( $mg2 -> marknew  *  84600 )  ? 
'infonew'  :  'info' ) . '">' ;  	echo '<div class="datum">' . SubStr ( $mg2 -> all_folders [ $i ] [ 2 ] ,  0 ,  8 ) . '</div>' ;  	echo '<div class="titel">' . SubStr ( $mg2 -> all_folders [ $i ] [ 2 ] ,  11 ) . '</div>' ;  	echo '<div class="fotograaf">' . $mg2 -> all_folders [ $i ] [ 10 ] . '</div>' ;  } 
?> 
 
         
     
 $iFolder , geen idee want ik snap niks van je script  
                      
                
                    
                         
                    
                    
                        
                            Abbas                             
                         
                     
                    
                        Crew .NET Kr4nKz1n  schreef:
Lache toch 
Gebruikers foutmelding en een script foutmelding 
Extra duudelijk.
Even een tekstje eronder met bv
[..quote..] 
  
                
                    
                         
                    
                    
                        
                            mvdg (laatste wijziging 03/11/2008 16:59)                             
                         
                     
                    
                        Nieuw lid titjes  schreef:
Moet heel die for-loop niet in een else van de if daarboven? Je controleert op mappen, zelfs al bestaan er geen gaat die for-loop toch uitgevoerd worden... Of vergis ik me?
    
    
        
            
                
<?php 
If ($n_folder = count($mg2->all_folders) < 1) 
{ 
echo '<br />Er zijn geen mappen aanwezig'; 
break;
}  
Else { 
rsort($mg2->all_folders); 
For($i=0;$i<count($mg2->all_folders);$i++) 
{  
if($mg2->all_folders[$i][1] != 1) unset($mg2->all_folders[$i]); 
}   
$mg2->all_folders = array_values($mg2->all_folders);           
for ($i=0;$i<4;$i++)   
{        
      echo 'verschillende weergaven van diverse waarden';	
} 
}
?> 
             
            <?php  
If  ( $n_folder  =  count ( $mg2 -> all_folders )  <  1 )  {  
echo '<br />Er zijn geen mappen aanwezig' ;  break ; 
}   
Else  {  
rsort ( $mg2 -> all_folders ) ;  For ( $i = 0 ; $i < count( $mg2 -> all_folders ) ; $i ++ )  
{   
if ( $mg2 -> all_folders [ $i ] [ 1 ]  !=  1 )  unset ( $mg2 -> all_folders [ $i ] ) ;  }    
for  ( $i = 0 ; $i < 4 ; $i ++ )    
{         
      echo 'verschillende weergaven van diverse waarden' ; 	 }  
} 
?> 
 
         
     
   
                
                    
                         
                    
                        
		
		
	             
 
                
Dit onderwerp is gesloten .