9 Replies - 790 Views - Last Post: 02 March 2012 - 06:08 AM

#1 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

PHP Virtual World Styling help

Posted 28 February 2012 - 06:42 PM

Hello! I am trying to create a PHP-based Virtual World! :) Just one problem, I can't make more than one image overlap! How would I do this? The code that contains it is
<?php
$counter = 2;
 for($count = 1; $count <= $num; $count++) {
$rows=mysql_fetch_array($query1);
$username_sql=$rows['Username'];
$server=$rows['Server'];
$avatar=$rows['Avatar'];
$x=$rows['X'];
$y=$rows['Y'];
?>
<style type="text/css">
.<?php echo $username_sql; ?>
{
    border: 0px solid #0f0;
    position: relative;
    z-index: <?php echo $counter; ?>;
    top: <?php echo $y; ?>px;
    left: <?php echo $x; ?>px;
}
</style>
<img class="<?php echo $username_sql; ?>" src="virtualworld/<?php echo $avatar; ?>.png" />
<?php
$counter = $counter + 1;
}
?>
Can someone give me a way to fix this?

Is This A Good Question/Topic? 0
  • +

Replies To: PHP Virtual World Styling help

#2 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 28 February 2012 - 06:50 PM

If you do not know PHP, but HTML/CSS... Base it off this code:
<style type="text/css">
.mainRunner
{
    border: 0px solid #000;
    position: relative;
}
</style>
<style type="text/css">
.easton39{
    border: 0px solid #0f0;
    position: relative;
    z-index: 2;
    top: -320px;
    left: 49px;
}
</style>
<img class="easton39" src="virtualworld/avatar.png" />
<style type="text/css">
.cool{
    border: 0px solid #0f0;
    position: relative;
    z-index: 3;
    top: -320px;
    left: 49px;
}
</style>
<img class="cool" src="virtualworld/avatar.png" />
<style type="text/css">
.base
{
    border: 0px solid #f00;
    position: relative;
    z-index: 1;
}
</style>
    <img class="base" src="virtualworld/base.png" />

I want easton39 to overlap cool and the base.
Was This Post Helpful? 0
  • +
  • -

#3 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Virtual World Styling help

Posted 29 February 2012 - 01:19 AM

position: absolute;
z-index: /* this number should be higher than the others */

This post has been edited by hiddenghost: 29 February 2012 - 01:21 AM

Was This Post Helpful? 1
  • +
  • -

#4 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 29 February 2012 - 06:15 AM

View Posthiddenghost, on 29 February 2012 - 01:19 AM, said:

position: absolute;
z-index: /* this number should be higher than the others */

Thank you, I will try this soon and see if it works. :)
Was This Post Helpful? 0
  • +
  • -

#5 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 29 February 2012 - 03:10 PM

View Posthiddenghost, on 29 February 2012 - 01:19 AM, said:

position: absolute;
z-index: /* this number should be higher than the others */

If you were looking at the code... It IS higher!

Oh wait... I see the difference...

Yup it works. :D
Was This Post Helpful? 0
  • +
  • -

#6 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 29 February 2012 - 03:29 PM

View Posteaston39, on 29 February 2012 - 03:10 PM, said:

View Posthiddenghost, on 29 February 2012 - 01:19 AM, said:

position: absolute;
z-index: /* this number should be higher than the others */

If you were looking at the code... It IS higher!

Oh wait... I see the difference...

Yup it works. :D

Wait no... IT DOESN'T!!!
Was This Post Helpful? 0
  • +
  • -

#7 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Virtual World Styling help

Posted 01 March 2012 - 04:22 PM

View Posteaston39, on 29 February 2012 - 04:29 PM, said:

View Posteaston39, on 29 February 2012 - 03:10 PM, said:

View Posthiddenghost, on 29 February 2012 - 01:19 AM, said:

position: absolute;
z-index: /* this number should be higher than the others */

If you were looking at the code... It IS higher!

Oh wait... I see the difference...

Yup it works. :D

Wait no... IT DOESN'T!!!


What? Repost the code with the changes you've made.
Was This Post Helpful? 0
  • +
  • -

#8 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 01 March 2012 - 06:43 PM

View Posthiddenghost, on 01 March 2012 - 04:22 PM, said:

View Posteaston39, on 29 February 2012 - 04:29 PM, said:

View Posteaston39, on 29 February 2012 - 03:10 PM, said:

View Posthiddenghost, on 29 February 2012 - 01:19 AM, said:

position: absolute;
z-index: /* this number should be higher than the others */

If you were looking at the code... It IS higher!

Oh wait... I see the difference...

Yup it works. :D

Wait no... IT DOESN'T!!!


<style type="text/css">

.easton39{
    position:absolute;
    z-index: 2;
    top: -315px;
    left: 50px;
}

.cool{
    position:absolute;
    z-index: 3;
    top: -320px;
    left: 49px;
}
.base
{
    position:relative;
    z-index: 1;
}

</style>
<img class="easton39" src="virtualworld/avatar.png" />
<img class="cool" src="virtualworld/avatar.png" />
    <img class="base" src="virtualworld/base.png" />


What? Repost the code with the changes you've made.

Was This Post Helpful? 0
  • +
  • -

#9 hiddenghost  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 39
  • View blog
  • Posts: 621
  • Joined: 15-December 09

Re: PHP Virtual World Styling help

Posted 02 March 2012 - 03:08 AM

What's not overlapping?

If you're images are dimensions are small enough and the top and left attributes are big enough the images won't touch eachother and won't overlap.

You have to adjust the top and left css to get the images to be in the same space.

The class called base should also have it's top and left configured to be somewhere in the same region as the other images.
Was This Post Helpful? 0
  • +
  • -

#10 easton39  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 16
  • Joined: 28-February 12

Re: PHP Virtual World Styling help

Posted 02 March 2012 - 06:08 AM

View Posthiddenghost, on 02 March 2012 - 03:08 AM, said:

What's not overlapping?

If you're images are dimensions are small enough and the top and left attributes are big enough the images won't touch eachother and won't overlap.

You have to adjust the top and left css to get the images to be in the same space.

The class called base should also have it's top and left configured to be somewhere in the same region as the other images.

Okay, I will try that later.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1