Log in

View Full Version : Layout question [Answered]


Fireballchad
09-02-2009, 01:17 AM
Hey there I am having a horrible time trying to make my pets be in collums,
//Loop out code
$i=0;
while ($i < $num) {

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");

$aid1=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel1=@mysql_result($result,$i,"currentlevel");
$type1=@mysql_result($result,$i,"type");
$name1=@mysql_result($result,$i,"name");
// Our code to determine if we show the table or not...


$article_content = $article_content."<center><table><tr>";



// Output the table information...
// Get the current adoptable's image

$image = getcurrentimage($aid);

$article_content = $article_content."<td><div align='center'><p>".$name."</p><p><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."' border=0></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid."'>Manage</a></b></p></div></td>";


$image1 = getcurrentimage($aid1);

$article_content = $article_content."<td><div align='center'><p>".$name1."</p><p><a href='myadopts.php?act=manage&id=".$aid1."'><img src='".$image1."' border=0></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid1."'>Manage</a></b></p></div></td>";

$article_content = $article_content."</tr></table></center><br>";
it keeps repeating the same adopt on the same line, ive been messing with the $i var and others to try to get it to "jump" one ahead to put it there but then the next line it falls back...

I want
pet-a | pet-b
pet-c | pet-d
I am getting when i mess with it
pet-a | pet-b
pet-b | pet-c

Ive read this (http://www.rusnakweb.com/forum/showthread.php?tid=987) but its not working

Seapyramid
09-03-2009, 10:37 AM
I accomplished this in MG through the use of CSS look at http://mysticgrove.net/grove/profile_hall.php?user=Sea

Fireballchad
09-04-2009, 01:18 AM
Ah, ok thanks for the tip. I forgot to update that I went with another route, when you hover the link it shows what it will look like, because my template is much more narrow that it would be goofy even with 2 next to each other. I was trying to make the page shorter is what I was after.

Fireballchad
02-09-2010, 04:36 PM
Ok I am going to bump this instead of making a new post.

As of right now I am using CSS li {display:inline;}

$article_content = $article_content."<ul><li>";



// Output the table information...
// Get the current adoptable's image

$image = getcurrentimage($aid);

$article_content = $article_content."<p>".$name."</p><p><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."' border=0></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid."'>Manage</a></b></p>";


$article_content = $article_content."</li>";

Yet it put them in a diagonal line down the screen. Not Side To Side.
A
...B
.....C
Instead of
A B C

Seapyramid
02-09-2010, 05:10 PM
It is because of the <p></p> each time it is used for one it goes to the next line & then when you make the next loop it starts at the next line down & continues the diagonal

Sea

Fireballchad
02-09-2010, 09:06 PM
It is because of the <p></p> each time it is used for one it goes to the next line & then when you make the next loop it starts at the next line down & continues the diagonal

Sea


Hmm still doesnt work... ugh shouldnt be this hard lol

Arianna
02-10-2010, 12:09 AM
This might not help you totally, because it's for my own script (not for this adoptables script), and it's for a shop, but it has a table which is made, making a new line every four columns.
$page .= "This is the item shop. Here you can buy a multitude of items for your pet to play with or use.<br />";
$query = "SELECT * FROM ".$prefix."itemkinds WHERE kind='shop'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i=0;
$page .="<table style='border:0px;'><tr>";
while ($i<$num) {
// `id` , `name` , `desc` , `cost` , `kind` , `img`
$id=@mysql_result($result,$i,"id");
$name=@mysql_result($result,$i,"name");
$desc=@mysql_result($result,$i,"desc");
$cost=@mysql_result($result,$i,"cost");
$kind=@mysql_result($result,$i,"kind");
$img=@mysql_result($result,$i,"img");
if ((($i+1)%4)!=0) {
$page .= "<td style='width:25%;'><a href='shop.php?shop=item&buy={$id}'><img src='{$img}'></a><br />{$cost}</td>";
}
else {
$page .= "<td style='width:25%;'><a href='shop.php?shop=item&buy={$id}'><img src='{$img}'></a><br />{$cost}</td></tr><tr>";
}
$i++;
}
if ($i%4!=0) {
$page .= "</table>";
}
else {
$page .= "</tr></table>";
}

Fireballchad
02-10-2010, 05:27 PM
Thank you soooo much, that was bugging the crap out of me!!! I got it to work after a bit of realizing some things i needed to delete :D!

Arianna
02-11-2010, 12:04 AM
That's great! :D Could I see the code, if I may?

Fireballchad
02-11-2010, 08:40 PM
That's great! :D Could I see the code, if I may?


if ((($i+1)%5)!=0) {
$article_content = $article_content."<td width='20%'><center><p><b>".$name."</b></p><p><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."' border=0></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid."'>Manage</a></b></p></center></td>";
}
else {
$article_content = $article_content."<td width='20%'><center><p><b>".$name."</b></p><p><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."' border=0></a></p><p>
<b><a href='myadopts.php?act=manage&id=".$aid."'>Manage</a></b></p></center></td></tr>";
}
$i++;
}
if ($i%5!=0) {
$article_content = $article_content."</table>";
}
else {
$article_content = $article_content."</tr></table>";
}

Sure there ya go (it is set up for a row of 5). But on another note I CAN not get it work in my adopt/shop page it blows it up every time >.< will post an example here when i take another crack at it if i can get it to work.