Changeset 31597 for trunk/www


Ignore:
Timestamp:
Nov 29, 2007, 12:22:56 AM (12 years ago)
Author:
jmpp@…
Message:

My brain lit up, columns creation is now amount of categories agnostic! Categories can now increase to whatever amount
and this code will simply work and list them all.

Also remove an unnecessary <br /> right underneath the h3, eliminating the necessity to push the lists up on the CSS.

Location:
trunk/www
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/macports.css

    r31594 r31597  
    197197
    198198#categories > ul > li {
    199     margin-top: -10px;
    200199    margin-bottom: 40px;
    201200}
  • trunk/www/ports.php

    r31590 r31597  
    5353<?php
    5454    if (!$by || (!$substr && $by != "all")) {
    55         echo "<h3>Port Categories</h3><br />";
    5655        $query = "SELECT DISTINCT category FROM $portsdb_name.categories ORDER BY category";
    5756        $result = mysql_query($query);
    5857        if ($result) {
    59             $columns = 0;
    60 ?>
     58?>
     59            <h3>Port Categories</h3>
     60
    6161            <div id="categories">
    6262           
     
    6464
    6565<?php
    66                     while ($columns < 5) {
    67                         $entries_per_colum = 0;
     66                    while ($row = mysql_fetch_assoc($result)) {
    6867?>
    6968                        <li>
    7069                            <ul>
    7170<?php
    72                                 while ($row = mysql_fetch_assoc($result)) {
     71                                $entries_per_colum = 0;
     72                                while (1) {
    7373?>
    7474                                    <li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=cat&amp;substr=<?php echo urlencode($row['category']); ?>">
     
    7777                                    if ($entries_per_colum == 14) break;
    7878                                    $entries_per_colum++;
     79                                    $row = mysql_fetch_assoc($result);
    7980                                }
    8081?>
     
    8283                        </li>
    8384<?php
    84                         $columns++;
    8585                    }
    8686?>
Note: See TracChangeset for help on using the changeset viewer.