<br /> Every 10 on file types

Discussion in 'PHP' started by walesalex, Aug 28, 2007.

  1. #1
    $end_type = end($CONFIG['file_types']);
    	$types    = '';
    	foreach($CONFIG['file_types'] as $key){
    		if($key == $end_type){
    			$types .= 'and .'.strtoupper($key);
    		}else{
     			$types .= '.'.strtoupper($key).',&nbsp;';
    		}
    	}
    
    PHP:
    <?php echo $types; ?>
    
    PHP:
    www.freefileuploader.com

    I'm trying to get the file types to have a linebreak every 10 so that it doesn't stretch the page. I tried...

    $brten = count($types);
    if ($brten = "10") {
    echo "ten";
    }
    
    PHP:
    but that doesn't seem to work. :(
    Thanks for any help!
     
    walesalex, Aug 28, 2007 IP
  2. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #2
    you could try this
     $count = 0 ;
    foreach($CONFIG['file_types'] as $key){
     if($key == $end_type){
                $types .= 'and .'.strtoupper($key); }
    else 
    $types .= '.'.strtoupper($key).',&nbsp;';
    echo "$types";
    if(bcmod($count , 10) == 0)  
    {
    echo "<br>" ;
    }
    $count++;
    }
    
    PHP:
     
    killerj, Aug 28, 2007 IP
  3. walesalex

    walesalex Peon

    Messages:
    552
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, but that didn't work. It repeated it a load more times though...
     
    walesalex, Aug 28, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Replace
    
    if(bcmod($count , 10) == 0)  
    
    PHP:
    With
    
    if (++$count % 10 == 0)
    
    PHP:

    And remove this:
    
    $count++;
    
    PHP:
     
    nico_swd, Aug 28, 2007 IP