How to Restyle Myadopts Page?

Forum
Last Post
Threads / Messages

AlexC

Moderator
Moderator
Joined
Dec 17, 2009
Messages
742
Points
0
Age
28
Location
Canada
Mysidian Dollar
43,036
So for a while I've redone the myadopts page on my site on a different style, which I prefer and find easier and quicker, but since the code change, I'm having trouble changing it - every time I try, the page goes blank and won't load.

I wanted it to look like this;

| image | trade status | rename - freeze - pound | click |
| name + species (gender) | # clicks / level # | stats - get codes - change trade status | |

imagine that is a table, with four cells and one row. I'm not entirely sure how to put things on top of other stuff in the new coding, let alone how to add other stuff.
 
umm if you have to play with the table, it may get a bit tricky. Here is the code used to generate myadopts index table:

PHP:
        $adoptTable = new TableBuilder("adopttable", 650);
        $adoptTable->setAlign(new Align("center", "middle"));
        $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
        
        while($aid = $stmt->fetchColumn()){
            $adopt = new OwnedAdoptable($aid);
            $gender = new TCell($adopt->getGender("gui"));
            $nametype = new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}");
            $image = new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui")));
            $clicks = new TCell($adopt->getTotalClicks());
            $level = new TCell($adopt->getCurrentLevel());
            $adoptTable->buildRow(array($gender, $nametype, $image, $clicks, $level));
        }

To change the header, simply edit the words inside the line $adoptTable->buildHeader(). To edit the actual contents, you will have to define each table cell with $cellName = new TCell("Contents inside"). Then add all table cells to the table row as shown in the last line $adoptTable->buildRow(). It is very convenient to use.

Note you can still just write a string of HTML code and use the below code to append it to your document:

PHP:
$html = "<table>Contents inside</table>";
$document->addLangvar($html);

It is not recommended though, since the GUI system is really good to use and moreover, it works well with the new URL system especially if you use relative url. Remember relative urls will not work with the script since we are having SEO friendly URL right now, unless you apply some complex trick to it.
 
Wait, how do I do another row though?
 
Last edited:
All you have to do is to build an additional row above the standard table rows and below the table header. Use this syntax:

PHP:
            $adoptTable->buildRow(array("Column 1", "Column 2", "Column 3", "Column 4"));
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Latest Posts

Top