Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Modify Shop Display (http://www.mysidiaadoptables.com/forum/showthread.php?t=5286)

Abronsyth 12-07-2016 10:00 AM

Modify Shop Display
 
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?

Hall of Famer 12-07-2016 10:11 AM

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);


lotus 12-07-2016 11:39 AM

Here's my code for /view/shopview.php:
PHP Code:

<?php

use Resource\Collection\LinkedList;

class 
ShopView extends View{
    
    public function 
index(){
        
$document $this->document;
        
$document->setTitle($this->lang->access);
        
        
$typeForm = new Form("shoptypes""shop""post");
        
$typeSelection = new DropdownList("shoptype");
        
$typeSelection->add(new Option("Itemshop""itemshop"));
        
$typeSelection->add(new Option("Adoptshop""adoptshop"));
        
$typeForm->add($typeSelection);
        
$typeForm->add(new Button("Go""submit""submit"));
        
$document->add($typeForm);
        
        
$shopList $this->getField("shopList");
        
        
$iterator $shopList->iterator();
        while(
$iterator->hasNext()){
            
$entry $iterator->next();
            
$shop $shopList->createshop($entry->getKey());
            
                    
# Display Shop...
            
$document->add(new Comment("<div style='display: inline-table;'>
            <a href='/shop/browse/
{$shop->shopname}'>
                <img src='
{$shop->imageurl}' rel='tooltip' title=\"{$shop->shopname}<br>
               <strong>Location:</strong> 
{$shop->category}<br>
               
{$shop->description}\">
               </a></div>"
FALSE));
        }
    }
    
    public function 
browse(){
        
$document $this->document;                    
        
$document->setTitle($this->lang->welcome);
        
$shop $this->getField("shop");
        
$shop->display();
    }
    
    public function 
purchase(){
        
$mysidia Registry::get("mysidia");
        
$cost $this->getField("cost");
        
$document $this->document;        
        
        if(
$mysidia->input->post("shoptype") == "itemshop"){
            
$document->setTitle($this->lang->global_transaction_complete);
            
$document->addLangvar("{$this->lang->purchase_item}{$cost->getValue()} {$mysidia->settings->cost}");
        }
        elseif(
$mysidia->input->post("shoptype") == "adoptshop"){
               
$document->setTitle($this->lang->global_transaction_complete);
            
$document->addLangvar("{$this->lang->purchase_adopt}{$cost->getValue()} {$mysidia->settings->cost}");      
        }
        else return;
    }
}
?>

I've taken the tables away entirely and replaced them with only linked pictures. Try setting the div width to 20% so it only takes up 1/5 of the page.

Abronsyth 12-13-2016 08:49 AM

Thank you both!

I've decided to use Lotus's modifications, now I can set it up to actually look like a market!


All times are GMT -5. The time now is 01:02 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.