View Single Post
  #4  
Old 10-21-2017, 11:00 AM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 65,316
Dinocanid is on a distinguished road
Default

I forgot about the table builder! I would say phase it out, absolutely. I'm in the process of doing that now, and the results are so much better; especially if you use Bootstrap (or Foundation):

This is the method I use for custom tables, and I highly recommend it:
PHP Code:
public function index(){
        
//header("Location: /myadopts");
        
$mysidia Registry::get("mysidia");
        
$document $this->document;
        
$document->setTitle($this->lang->title);
        
//tab title
 
$document->add(new Comment("<title>Your Pantry</title>"));

        
$pagination $this->getField("pagination");
        
$stmt $this->getField("stmt")->get();
        if(
$stmt->rowCount() == 0){
            
$document->addLangvar($this->lang->empty);
            return;
        }
        
$shelfSpace $mysidia->db->select("users", array("shelfspace"), "username = '{$mysidia->user->username}'")->fetchColumn(); 
        
$adoptAmount $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' AND health > '0'")->rowCount();
        if(
$adoptAmount >= 10){
        
$mysidia->db->update("users_status", array("fullpantry" => 'unlocked'), "username='{$mysidia->user->username}'");
        }
        
$document->add(new Comment("
            <div class='card'>
              <h2 class='card-header'><center>Pantry Stats</center></h2>
              <div class='card-body'>
                    <b>Shelf space:</b> 
{$adoptAmount}/{$shelfSpace} <a href='/expand' class='badge badge-secondary'>+</a>
              </div>
            </div>"
));
         
$document->add(new Comment("<table class='table table-bordered table-dark'>
  <thead>
    <tr>
      <th>Image</th>
      <th>Info</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>"
FALSE));
        while(
$aid $stmt->fetchColumn()){
            
$adopt = new OwnedAdoptable($aid);
            
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn(); 
            
$type $adopt->getType();
                   if (
$gender_lookup == "m") { $Gender "Male"; } 
                   if (
$gender_lookup == "f") { $Gender "Female"; }
                   
                   
$document->add(new Comment("<tr>
      <td><img src='
{$adopt->getImage()}'></td>
      <td><b><em>
{$adopt->getName()}</b></em><br></br> Level {$adopt->getCurrentLevel()}<br></br> {$Gender}</td>
      <td><a href='/myadopts/manage/
{$aid}' class='btn btn-primary' style='width:200px; height:auto;'>Manage</a></td>
    </tr>"
FALSE));
                   } 
        
        
$document->add(new Comment("</tbody></table>"));
    } 
It can even by applied to messages and stuff:


For #6, I've only ever tried it in the view file, so I don't know. I would try styling with "<style></style>" above the PHP tags first, since I don't know if "link rel" would work; you can try it though.
__________________
Reply With Quote