View Single Post
  #2  
Old 12-07-2016, 10:11 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,984
Hall of Famer is on a distinguished road
Default

You need to create a table without border, and then you need to calculate the number of rows from total shops and the columns(5 in your case). You will use PHP for loops to add table cells to a table row until it needs to switch to a new row. Finally you add all rows to the table, and add table to the document.

If it sounds too complex, you can take a look at levelupview.php file and method daycare(), it will give you an example of how to create Icon View. It is not very difficult once you get a hang of it.

Code:
        $daycareTable = new Table("daycare", "", FALSE);
        $total = $daycare->getTotalAdopts();
        $index = 0;

        for($row = 0; $row < $daycare->getTotalRows(); $row++){
            $daycareRow = new TRow("row{$row}");
            for($column = 0; $column < $daycare->getTotalColumns(); $column++){
                $adopt = new OwnedAdoptable($adopts[$index]);
                $cell = new ArrayList;
                $cell->add(new Link("levelup/click/{$adopt->getAdoptID()}", $adopt->getImage("gui"), TRUE));
                $cell->add(new Comment($daycare->getStats($adopt)));
                $daycareCell = new TCell($cell, "cell{$index}");
                $daycareCell->setAlign(new Align("center", "center"));
                $daycareRow->add($daycareCell);
                $index++;
                if($index == $total) break;
            }
            $daycareTable->add($daycareRow);            
        }
        
        $document->add($daycareTable);
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote