![]() |
#1
|
||||
|
||||
![]()
I am trying to modify the shop listing display so that shops are next to one another (I am only showing the images), instead of over one another. So, say I have 5 shops, it show 5 shops all next to one another horizontally.
Say I have 10 shops, it has 2 rows of 5. I am not very clever with PHP generated tables, so I am a wee bit lost. Does anyone know how I might accomplish this?
__________________
My Mods Site (1.3.4, 2020 Mods) |
#2
|
||||
|
||||
![]()
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. |
#3
|
||||
|
||||
![]()
Here's my code for /view/shopview.php:
PHP Code:
Last edited by lotus; 12-07-2016 at 11:44 AM. |
#4
|
||||
|
||||
![]()
Thank you both!
I've decided to use Lotus's modifications, now I can set it up to actually look like a market!
__________________
My Mods Site (1.3.4, 2020 Mods) |
![]() |
Thread Tools | |
Display Modes | |
|
|
What's New? |
What's Hot? |
What's Popular? |