Example #1
0
function getColumnData($categories, $defineColumn = 3)
{
    $topCategories = getCategoriesByPid($categories);
    $data = array();
    if (count($topCategories) >= $defineColumn) {
        for ($i = 1; $defineColumn >= $i; $i++) {
            $data[$i] = array();
        }
        $c = 1;
        $x = 0;
        foreach ($topCategories as $v) {
            $r = $c - $defineColumn * $x;
            if ($c / $defineColumn >= $x + 1) {
                $x++;
            }
            $c++;
            array_push($data[$r], $v);
        }
    } else {
        die('Not enough top categories.');
    }
    return $data;
}
Example #2
0
                                    <a href="" target="_blank" title="<?php 
                    echo $cc['name'];
                    ?>
"<?php 
                    if ($cc['recommend']) {
                        ?>
 class="color-red"<?php 
                    }
                    ?>
>
                                        <?php 
                    echo $cc['name'];
                    ?>
                                    </a>
                                    <?php 
                    $sc = getCategoriesByPid($categories, $cc['id']);
                    if (!empty($sc)) {
                        ?>
 
                                    <div class="small">
                                        <?php 
                        foreach ($sc as $ccc) {
                            ?>
   
                                            <a href="" target="_blank" title="<?php 
                            echo $ccc['name'];
                            ?>
"<?php 
                            if ($cc['recommend']) {
                                ?>
 class="color-red"<?php