Layout question [Answered]

Forum
Last Post
Threads / Messages

Fireballchad

Member
Member
Joined
Aug 28, 2009
Messages
49
Points
0
Age
32
Mysidian Dollar
4,928
Hey there I am having a horrible time trying to make my pets be in collums,
PHP:
//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 but its not working
 
RE: php question

I accomplished this in MG through the use of CSS look at http://mysticgrove.net/grove/profile_hall.php?user=Sea
 
RE: php question

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.
 
RE: php question

Ok I am going to bump this instead of making a new post.

As of right now I am using CSS li {display:inline;}
PHP:
$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
 
RE: php question

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
 
RE: php question

Seapyramid said:
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
 
RE: php question

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.
PHP:
		$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>";
		}
 
RE: php question

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!
 
RE: php question

That's great! :D Could I see the code, if I may?
 
RE: php question

Arianna said:
That's great! :D Could I see the code, if I may?

PHP:
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.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,278
Messages
33,127
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top