PDA

View Full Version : Two links or more + images in 1 row


TLT96
05-05-2014, 07:07 PM
Well, i want to edit a lot of mysidia, i have some changes but i get stuck in this part....

I want to put two links with images in one row... Here the code (I tried but i cant...)

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle($this->lang->title);

$pagination = $this->getField("pagination");
$stmt = $this->getField("stmt")->get();
if($stmt->rowCount() == 0){
$document->addLangvar($this->lang->empty);
return;
}

$adoptTable = new TableBuilder("adopttable", 650);
$adoptTable->setAlign(new Align("center", "middle"));
$adoptTable->buildHeaders("First", "Second", "Third", "Fourth");

while($aid = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($aid);
$cells = new LinkedList;
$STATS=new Link("myadopts/stats/{$aid}", new Image("templates/icons/stats.gif"));
$FEEDEAR=new Link("levelup/click/{$aid}", new Image("templates/icons/add.gif"));
$cells->add($STATS);
$cells->add(new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui"))));
$cells->add(new TCell($adopt->getTotalClicks()));
$cells->add(new TCell($adopt->getNivel()));
$adoptTable->buildRow($cells);
}
$document->add($adoptTable);
$document->addLangvar($pagination->showPage());
}

I have two variables called: STATS and FEEDEAR, they have links with images (Using codes from mysidia), but i cant put in just 1 row (I know how to put sepparated in two rows) but i want to show two images with links in the same row....

Php/Html knowledge = 2/10 :wiii:

Hwona
05-05-2014, 07:20 PM
Um, by any chance, are you trying to display an adoptable's stats on its click page? Sorry, I can't understand you very well, because if that's the case, someone just finished helping me with that. :3

Edit: Sorry, mistook the code for another! Wait, are the links in there?

IntoRain
05-05-2014, 07:31 PM
In the same row or in the same cell?

Cells is a linked list of TCells that form a row. Each TCell is a single cell in that row.

To put them in the same row but different cells, you need to create a TCell for each thing you want to add, like

$cells->add(new TCell($STATS));
$cells->add(new TCell($FEEDEAR));
etc... (you have four columns it seems from the header, so you can only add four Tcells)

To put them in the same cell, I believe there is no other way other than putting it all inside a Comment and then the comment inside the TCell, like

$comment = new Comment("{$variableHere} blablabla <img src='link.png'> blablabla");//comments can have html
$cells->add(new TCell($comment));

TLT96
05-05-2014, 09:17 PM
Um, by any chance, are you trying to display an adoptable's stats on its click page? Sorry, I can't understand you very well, because if that's the case, someone just finished helping me with that. :3

Edit: Sorry, mistook the code for another! Wait, are the links in there?
Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports
http://www.mysidiaadoptables.com/forum/entertainage/misc/navbits_finallink_ltr.gif Showing stats on click page (http://www.mysidiaadoptables.com/forum/showthread.php?t=4472)

Dont worry :D

In the same row or in the same cell?

Cells is a linked list of TCells that form a row. Each TCell is a single cell in that row.

To put them in the same row but different cells, you need to create a TCell for each thing you want to add, like

$cells->add(new TCell($STATS));
$cells->add(new TCell($FEEDEAR));
etc... (you have four columns it seems from the header, so you can only add four Tcells)

To put them in the same cell, I believe there is no other way other than putting it all inside a Comment and then the comment inside the TCell, like

$comment = new Comment("{$variableHere} blablabla <img src='link.png'> blablabla");//comments can have html
$cells->add(new TCell($comment));
Thx you soo much :D

I dont need those variables, i didnt know about that, y just write the code like i learn (Simple html) and obviously work :D

public function index(){
$mysidia = Registry::get("mysidia");
$document = $this->document;
$document->setTitle($this->lang->title);

$pagination = $this->getField("pagination");
$stmt = $this->getField("stmt")->get();
if($stmt->rowCount() == 0){
$document->addLangvar($this->lang->empty);
return;
}

$adoptTable = new TableBuilder("adopttable", 650);
$adoptTable->setAlign(new Align("center", "middle"));
$adoptTable->buildHeaders("Acciones", "Monster", "Exp", "Nivel");

while($aid = $stmt->fetchColumn()){
$adopt = new OwnedAdoptable($aid);
$cells = new LinkedList;
$comment = new Comment("<a href='levelup/click/{$aid}'><img src='templates/icons/add.gif'></a>
<a href='myadopts/manage/{$aid}'><img src='templates/icons/stats.gif'></a>
<a href='myadopts/stats/{$aid}'><img src='templates/icons/bbcodes.gif'></a>");
$cells->add(new TCell($comment));
$cells->add(new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui"))));
$cells->add(new TCell($adopt->getTotalClicks()));
$cells->add(new TCell($adopt->getNivel()));
$adoptTable->buildRow($cells);
}
$document->add($adoptTable);
$document->addLangvar($pagination->showPage());
}

Thx :D
So.... we end with this thread... Thx :D

How i can thank you? :D

PD: Sorry for my english.... (Im getting better but slower....)