Jump to content

Archived

This topic is now archived and is closed to further replies.

Solarpitch

Customizing Dynamic Tables?

Recommended Posts

Hey Guys,

I am developing an application that requires me to pull values from the database and show them up nice and pretty in a table! Ok . . that part is easy, but I want to customize the table.

To help explain what I'm on about, www.golftrader.co.uk has a perfect example. As you can see thier on the home page, each add is pulled out in a row and everything seems to be nicely positioned in each row . . ie

. . The rows stays a consistent size
. . Theres a nice tumbnail displayed with each add
. . The text seems to be consistent too

This is an exact example of the way I would like to implement it in my example! Would any of you guys be able to give me a few tips in being able to achieve this work of art?

It's probably easy to you lot!

Thanks,
Gerard. 

Share this post


Link to post
Share on other sites
It's all just html fun at the point you get the variables from the table...

You said you had no problem getting the values from the table so I can assume that you just need insight on how to style it? Just plug the variables into fancy html/css!

[code]
$result = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($result)) {
$imageurl = $row['imageurl'];
$title = $row['title'];
$author = $row['author'];
$date = $row['date'];
$description = $row['description'];

echo "
<div class='container'>
<div class='image'><img src='$imageurl' alt='image' /></div>
<div class='title'>$title</div>
<div class='author'>$author</div>
<div class='date'>$date</div>
<p class='description'>
$description
</p>
</div>";
}
[/code]

then you would just define the styles for the classes... you could use style tags instead of the classes in the above example... there really isn't much to it... an example of your css file could be like...

[code]
.container {
clear:both;
border-bottom:1px solid #000000;
}
.image {
float:left;
padding:3px;
border:1px solid #000000;
}
.title {
font-weight:bold;
}
[/code]
of course there would be more stylings... but your issue isn't near as much PHP as it is html/css tinkering.

Share this post


Link to post
Share on other sites
Fair play to you . . I just wansnt really sure where to start messing with the html to get the look I wanted. That code is after helping big time!! Thanks again!

Gerard.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.