Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2016, 10:00 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,110
Abronsyth is on a distinguished road
Default 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?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 12-07-2016, 10:11 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: 331,612
Hall of Famer is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 12-07-2016, 11:39 AM
lotus's Avatar
lotus lotus is offline
Member
 
Join Date: Oct 2016
Posts: 7
Gender: Female
Credits: 1,043
lotus is on a distinguished road
Default

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.

Last edited by lotus; 12-07-2016 at 11:44 AM.
Reply With Quote
  #4  
Old 12-13-2016, 08:49 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,110
Abronsyth is on a distinguished road
Default

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)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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

Currently Active Users: 591 (0 members and 591 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636