View Single Post
  #2  
Old 04-03-2013, 10:14 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: 392,963
Hall of Famer is on a distinguished road
Default

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 Code:
        $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 Code:
$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.
__________________


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