Topic: In need of some assistance with a mod

I am trying to modify the code below so that my post_icons can be 8 per line. As it is now they are all displayed on one line and breaks the theme on some browsers. Can anyone help me out here.

if ($fid): 
        $icons_topic = array();
        $d = dir(PUN_ROOT.'img/icons');
                echo '<div class="blockform">
             <div style="width: 650px;" class="inform">
                <fieldset id="post_icons" class="icon_topics">
                    <legend>Topic Icons</legend>';
        while (($entry = $d->read()) !== false)
        {
            if (substr($entry, strlen($entry)-4) == '.gif') $icons_topic[] = substr($entry, 0, strlen($entry)-4);
        }
        $d->close();
        if (count($icons_topic) > 1)
        {
            while (list(, $temp) = @each($icons_topic)) echo '<input type="radio" name="icon_topic" value="'.$temp.'" />&nbsp;<img src="img/icons/'.$temp.'.gif" title="'.$temp.'" alt="'.$temp.'" />&nbsp;';
            echo '<input type="radio" name="icon_topic" value="0" checked="checked" />&nbsp;None';
        }
?>    
                </fieldset>
            </div>
        </div>

Thanks
Shedrock

FluxBB Site - Shedrock Online

Re: In need of some assistance with a mod

untested

$count = 0;
while (list(, $temp) = @each($icons_topic)) {
    if ($count == '8') {
        $count = '0';
        echo '<br />';
    }
        
    echo '<input type="radio" name="icon_topic" value="'.$temp.'" />&nbsp;<img src="img/icons/'.$temp.'.gif" title="'.$temp.'" alt="'.$temp.'" />&nbsp;';
    
    ++$count;
}
echo '<input type="radio" name="icon_topic" value="0" checked="checked" />&nbsp;None';

Re: In need of some assistance with a mod

Thank you so much for this. It works like a charm. smile

Cheers!
Shedrock

FluxBB Site - Shedrock Online