this is a very messy code, i tried to copy from one to other. it displays images and the name and last name of the person. it does it vertically and i need to show let say in two columns so the third image and the name last name falls to next row and etc. would you please help me with hthis?

thank you

function showfavorites_run_template_user_fields($tag = '') {
	$strip = explode("_", $tag);
	$quantity = $strip[3];
	$tag = "$strip[0]_$strip[1]_$strip[2]";
	switch ($tag) {
		case 'addon_showfavorites_viewnum':
			$data = showfavorites_view($quantity);
			break;
		default:
			$data = '';
			break;
		}
	return $data;
	}

// Addon Specific Function
function showfavorites_view($quantity) {
	global $conn, $config, $db_type;
	require_once($config['basepath'] . '/include/misc.inc.php');
	require_once($config['basepath'] . '/include/listing.inc.php');
	require_once($config['basepath'] . '/include/images.inc.php');
	$misc = new misc();
	$display = '';
	$user_id = $_GET['user'];
	if ($db_type == 'mysql') {
		$rand = 'RAND()';
		} else {
		$rand = 'RANDOM()';
		}
	$sql = "SELECT listingsdb_id FROM " . $config['table_prefix'] . "userfavoritelistings WHERE userdb_id=" . $user_id . " ORDER BY " . $rand;
	$recordSet = $conn->SelectLimit($sql, $quantity, 0);
	if ($recordSet === false) {
		$misc->log_error($sql);
		}
	if ($recordSet->RecordCount() > 0) {
		$display .= '<div id="addon_favorites">';
		$display .= '<p>Arkada&#351; Listesi:</p>';
		$display .= '<ul>';
		while (!$recordSet->EOF) {
			$listingsdb_id = $misc->make_db_unsafe($recordSet->fields['listingsdb_id']);
			$listingSQL = '';
			$listingSQL .= "(listingsdb_id = " . $listingsdb_id . ") AND (listingsdb_active = 'yes')";
			if ($config['use_expiration'] == 1) {
				$listingSQL .= " AND (listingsdb_expiration > " . $conn->DBDate(time()) . ")";
				}
			$sql2 = "SELECT userdb_id FROM " . $config['table_prefix'] . "listingsdb WHERE " . $listingSQL;
			$recordSet2 = $conn->Execute($sql2);
			if ($recordSet2 === false) {
				$misc->log_error($sql2);
				}
   

		$listing_userdb_id = $misc->make_db_unsafe($recordSet2->fields['userdb_id']);
			//$agent_thumbnail = image_handler::renderUserImages($listing_userdb_id);
$agent_thumbnail = renderUserImages($listing_userdb_id );
			$listing_agent_firstName = listing_pages::getListingAgentFirstName($listingsdb_id);
			$listing_agent_lastName = listing_pages::getListingAgentLastName($listingsdb_id);
			$listing_agent_link = listing_pages::getListingAgentLink($listingsdb_id);
$display .= '<p>' . $agent_thumbnail . ' </p><li><a href="' . $listing_agent_link . '" title="' . $listing_agent_firstName . ' ' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_lastName . '">' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_firstName . '&nbsp;' . $listing_agent_lastName . '</a></li>';
$recordSet->MoveNext();
			}
		$display .= '</ul>';
		$display .= '</div>';
		} else {
		// DO NOTHING - THIS USER HAS NO FAVORITES
		}
	return $display;
	}

function renderUserImages($user)
	{
		// grabs the listings for a given user
		global $conn, $config, $lang;
		require_once($config['basepath'] . '/include/misc.inc.php');
		$misc = new misc();
		$display = '';
		$user = $misc->make_db_safe($user);
		// grab the images
		$sql = "SELECT userimages_id, userimages_caption, userimages_thumb_file_name FROM " . $config['table_prefix'] . "userimages WHERE userdb_id = $user ORDER BY userimages_rank LIMIT 0, 1";
		$recordSet = $conn->Execute($sql);
		if ($recordSet === false) {
			$misc->log_error($sql);
		}
		$num_images = $recordSet->RecordCount();
		if ($num_images > 0) {
			while (!$recordSet->EOF) {
				$caption = $misc->make_db_unsafe ($recordSet->fields['userimages_caption']);
				$thumb_file_name = $misc->make_db_unsafe ($recordSet->fields['userimages_thumb_file_name']);
				// $file_name = $misc->make_db_unsafe ($recordSet->fields['userimages_file_name']);
				$imageID = $misc->make_db_unsafe ($recordSet->fields['userimages_id']);
				// gotta grab the image size
				$imagedata = GetImageSize("$config[user_upload_path]/$thumb_file_name");
				$imagewidth = $imagedata[0];
				$imageheight = $imagedata[1];
					$max_width = $config['thumbnail_width'];
					$max_height = $config['thumbnail_height'];
					$resize_by = $config['resize_thumb_by'];
					$shrinkage = 1;
					if (($max_width == $imagewidth) || ($max_height == $imageheight)) {
					$displaywidth = $imagewidth;
					$displayheight = $imageheight;
					} else {
						if ($resize_by == 'width') {
							$shrinkage = $imagewidth / $max_width;
							$displaywidth = $max_width;
							$displayheight = round($imageheight / $shrinkage);
						} elseif ($resize_by == 'height') {
							$shrinkage = $imageheight / $max_height;
							$displayheight = $max_height;
							$displaywidth = round($imagewidth / $shrinkage);
						} elseif ($resize_by == 'both') {
							$displayheight = $max_height;
							$displaywidth = $max_width;
						}
					}
				//$display .= "<a href=\"index.php?action=view_user_image&amp;image_id=$imageID\"> ";
//$display .= "<a href=\"$config[baseurl]/index.php?action=view_user&user=$userID\">";
//$display .= '<p>' . $agent_thumbnail . ' </p><li><a href="' . $listing_agent_link . '" title="' . $listing_agent_firstName . ' ' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_lastName . '">' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_firstName . '&nbsp;' . $listing_agent_lastName . '</a></li>';
				//$display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"></a><br /> ";
								$display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"></a>";

$display .= "<b>$caption</b><br />";
				$recordSet->MoveNext();
			}
		}else {
			$display .= "<img src=\"images/nophoto_1.gif\" alt=\"\" /><br />";
		} // end ($num_images > 0)
		return $display;
	} // end function renderUserImages

?>

I think this is more of a styling question. My suggestion is to set DIVs around each data (name, last name and image) then using CSS set the width and height to be all the same then float:left. something like this:

div.display{
background-color:#161616;
text-align:center;
float:left;
width:190px;
margin:10px 4px;
height:200px;
border-right:1px solid #333;
border-bottom:1px solid #333;
}

Remember height, and width are the most important to look nice.

I think for you you ca just modify the second to last line to return "<div class='display'>".$display."</div>";

where do i say how many columns how may rows?


thank you

you have to play with CSS width value because they will automatically jump to the bottom if there is not enough space in the containing div.

you have that option or you can use tables but tables are really bulky IMO.

check out this site and check the css code for div.r_main its the same I gave you above but it'll give you an idea of how it'll look. http:://metalportals.com

thank you for trying to help but did not work, i know the way i have it very messy.

thanks

do you have a live site? maybe i can go there and give you a simply css solution.

you have a lot of commented lines but I don't see on the site what you have in the code. which one is the one that is currently working?

while (!$recordSet->EOF) {
				$caption = $misc->make_db_unsafe ($recordSet->fields['userimages_caption']);
				$thumb_file_name = $misc->make_db_unsafe ($recordSet->fields['userimages_thumb_file_name']);
				// $file_name = $misc->make_db_unsafe ($recordSet->fields['userimages_file_name']);
				$imageID = $misc->make_db_unsafe ($recordSet->fields['userimages_id']);
				// gotta grab the image size
				$imagedata = GetImageSize("$config[user_upload_path]/$thumb_file_name");
				$imagewidth = $imagedata[0];
				$imageheight = $imagedata[1];
					$max_width = $config['thumbnail_width'];
					$max_height = $config['thumbnail_height'];
					$resize_by = $config['resize_thumb_by'];
					$shrinkage = 1;
					if (($max_width == $imagewidth) || ($max_height == $imageheight)) {
					$displaywidth = $imagewidth;
					$displayheight = $imageheight;
					} else {
						if ($resize_by == 'width') {
							$shrinkage = $imagewidth / $max_width;
							$displaywidth = $max_width;
							$displayheight = round($imageheight / $shrinkage);
						} elseif ($resize_by == 'height') {
							$shrinkage = $imageheight / $max_height;
							$displayheight = $max_height;
							$displaywidth = round($imagewidth / $shrinkage);
						} elseif ($resize_by == 'both') {
							$displayheight = $max_height;
							$displaywidth = $max_width;
						}
					}
				//$display .= "<a href=\"index.php?action=view_user_image&amp;image_id=$imageID\"> ";
//$display .= "<a href=\"$config[baseurl]/index.php?action=view_user&user=$userID\">";
//$display .= '<p>' . $agent_thumbnail . ' </p><li><a href="' . $listing_agent_link . '" title="' . $listing_agent_firstName . ' ' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_lastName . '">' . $listing_agent_thumbnail . '&nbsp;' . $listing_agent_firstName . '&nbsp;' . $listing_agent_lastName . '</a></li>';
				//$display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"></a><br /> ";
								$display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"></a>";

$display .= "<b>$caption</b><br />";
				$recordSet->MoveNext();
			}

I need the first, last, and image wrapped in a div with any class name to be able to do anything with them.

i have no idea.
i know the commented ones are not working i can even delete them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.