images in the Trade Search for Adopts

Forum
Last Post
Threads / Messages

Milly Money

Pet-Sim.Online
Staff member
Dev Staff
Joined
Jan 27, 2010
Messages
538
Points
18
Mysidian Dollar
28,331
If I wanted to have a small image show for each Pet on this page:

/search/adopt

Would that be a simple thing to do?

I tried pasting in code from the myadopts where the image is shown for the pets, but it didn't work.

I just want to add a small image for each one, right behind where the 'fortrade' column is :)

I'd like it to pull from imageurl in owned adoptables. Any help would be amazing !


1623111619043.png
 
Oh man! Something I can finally help with!!! :D

Okay, so in your searchview.php file you want to go to the TCell section.

You want to add in the header area the title for the image, I used "Image".

Then in your area above the LinkedList you want to add:

PHP:
$image = $adopt->getImage();

In the TCell area you want to add:

PHP:
$cells->add(new TCell("<img style='width:100px;' src='{$adopt->getImage()}'>"));

This will get the image of your adopt, and the width area I added let's you change the size of the image.

___________

So my whole adopt area in that file looks like this:

PHP:
public function adopt(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        $document->setTitle($this->lang->adopt);     
        if($mysidia->input->post("submit")){
            $adoptList = $this->getField("adoptList");
            $iterator = $adoptList->iterator();
            $searchTable = new TableBuilder("searchresult");
            $searchTable->setAlign(new Align("center"));
            $searchTable->buildHeaders("ID", "Image", "Name", "Type", "Owner", "Level", "Gender", "Trade"); 
            $searchTable->setHelper(new SearchTableHelper);
                 
            while($iterator->hasNext()){
                $adopt = $iterator->next();
                $image = $adopt->getImage();
                $cells = new LinkedList;
                $cells->add(new TCell($adopt->getAdoptID()));
                $cells->add(new TCell("<img style='width:100px;' src='{$adopt->getImage()}'>"));
                $cells->add(new TCell($searchTable->getHelper()->getAdoptName($adopt->getAdoptID(), $adopt->getName())));
                $cells->add(new TCell($adopt->getType()));
                $cells->add(new TCell($searchTable->getHelper()->getUserProfile($adopt->getOwner())));
                $cells->add(new TCell($adopt->getCurrentLevel()));
                $cells->add(new TCell($searchTable->getHelper()->getGenderImage($adopt->getGender())));
                $cells->add(new TCell($searchTable->getHelper()->getTradeStatus($adopt->getAdoptID(), $adopt->getTradeStatus())));
                $searchTable->buildRow($cells);
            }
            $document->add($searchTable);         
            return;
        }
and here is my page.
1623115570279.png

Edit: So you just need to place the header text to the left of the trade header if that's where you want it. And Also move the TCell above the trade TCell.
 
Last edited by a moderator:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top