Announcement

Collapse
No announcement yet.

Trade supply page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Here's the psuedocode for this:

    Code:
    NumColumns = 4;
    
    while (data = getDBdata) {
        Format data to have proper link and assign it to data_with_link
        MyArray[] = data_with_link
    }
    
    NumZones = count(MyArray);
    NumZonesPerColumn = NumZones / NumColumns;
    If NumZonesPerColumn > int(NumZonesPerColumn)
    {
        // this deals with the fractional part
        NumZonesPerColumn = int(NumZonesPerColumn) + 1;
    }
    
    ZoneCounter = 0;
    
    start table.
    for (ColumnCounter = 1 to NumColumns)
    {
        print "<td>"
        for (counter = 1 to NumZonesPerColumn)
        {
            print MyArray[ZoneCounter] . "<br>";
            ZoneCounter++
        }
        print "</td>"
    }
    end table.
    Note that if you have a number of zones that doesn't divide evenly into the columns, the final column will contain a number of empty lines at the end, making it match the other cells in height.

    There's probably a more elegant way to do it that doesn't involve using three counters and two loops, but this should work.
    Sir KyrosKrane Sylvanblade
    Master Artisan (300 + GM Trophy in all) of Luclin (Veeshan)
    Master Fisherman (200) and possibly Drunk (2xx + 20%), not sober enough to tell!
    Lightbringer, Redeemer, and Valiant servant of Erollisi Marr

    Comment


    • #17
      Seems Ngreth stated something like he doesnt like the array idea. Thus the one with the count. This query is quite fast and optimized by MySQL and shouldnt take long.
      LazyLizard Saruton
      Dreadlord of Greenmist
      Keeper of the Lost tome of complete and utterly nonsense
      Master Linguist

      Comment


      • #18
        go ahead and keep with the ideas.

        They are requiring us to work today. So I will not be getting to this this weekend.
        Ngreth Thergn

        Ngreth nice Ogre. Ngreth not eat you. Well.... Ngreth not eat you if you still wiggle!
        Grandmaster Smith 250
        Master Tailor 200
        Ogres not dumb - we not lose entire city to froggies

        Comment

        Working...
        X