Jump to content


Photo

Customizing Dynamic Tables?


  • Please log in to reply
2 replies to this topic

#1 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 28 October 2006 - 08:26 PM

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. 
Welcome to 9AM Monday, the furthest point away from 5PM Friday.

#2 genericnumber1

genericnumber1
  • Members
  • PipPipPip
  • Advanced Member
  • 1,858 posts

Posted 28 October 2006 - 09:34 PM

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!

$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>";
}

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

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

#3 Solarpitch

Solarpitch
  • Members
  • PipPipPip
  • Advanced Member
  • 708 posts
  • LocationDublin, Ireland

Posted 28 October 2006 - 09:50 PM

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.
Welcome to 9AM Monday, the furthest point away from 5PM Friday.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users