Making this table smaller ... losing the white space

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jonelle
Forum Newbie
Posts: 18
Joined: Sat Sep 11, 2004 8:08 pm

Making this table smaller ... losing the white space

Post by Jonelle »

Weirdan | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi,

I'm using this dating software that my company purchased for this dating site I have to put together. Anyways, I'm stuck at trying to figure out how to resize this particular table. On the main page, there's a "Members" section displaying the amount of people registered and online. You can see it [url=http://midnytemedia.com/chit-chat/]here[/url]. It has a big amount of space above and below the information, and I've been going through the code trying to figure out how to resize it and get rid of that empty white space. The code is as follows:

Code: Select all

$total_c = strlen( $_POST[total_c] ) ? (int)$_POST[total_c] : GetParam( "default_country" );
	$total_c2 = strlen( $_POST[total_c2] ) ? (int)$_POST[total_c2] : GetParam( "default_country" );
	$total_arr = db_arr( "SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active'" );
	$total_arr_week = db_arr( "SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(LastReg)) <= 7" );
	$total_arr_gold = db_arr( "SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND ExtraAddons IS NOT NULL AND ExtraAddons != ''" );
	$total_c_arr = db_arr( "SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND Country = $total_c" );
	$total_members = $total_arr[0];
	$total_c_members = $total_c_arr[0];

	$total_c_members_onl = get_users_online_number('c', $total_c2 );
	$total_arr_chatting = get_users_online_number('t');
	$members_online = get_users_online_number();


	$c_arr = $prof[countries];


	$out = "";
    $out .= '<table width=140 cellpadding=0 cellspacing=0 border=0 align=center><tr><td>';
    $out .= '<table width=140 cellpadding=0 cellspacing=0 class=text border=0 align=center>';
    $out .= "<tr><td width=17><img width=17 height=14 src=$site[images]group1.gif></td><td width=100%><b>&nbsp;"._t("_Currently Online")."</b></td></tr>\n";
    
	$out .= "<tr><td width=17 align='right'><img width=17 height=14 src='$site[images]us2.gif'></td><td width=100%>&nbsp;"._t("_Total")." -  $members_online</td></tr>\n";
    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src='$site[images]us3.gif'></td><td width=100%>&nbsp;"._t("_Chatting")." - $total_arr_chatting </td></tr>\n";
    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src='$site[images]us4.gif'></td><td width=100%>&nbsp;$total_c_members_onl "._t("_members")." "._t("_from").":</td></tr>\n";
    $out .= '<form action="'.$_SERVER[PHP_SELF].'" method=post name="cForm2"><tr><td align=right colspan=2>';
    $out .= "<input type=hidden name=total_c value=$total_c>";
    $out .= '<select class=index name=total_c2 onChange="javascript: document.forms[''cForm2''].submit();">';
    foreach ( $c_arr as $key => $value )
    {
            $out .= "<option value=$key";
            if ( $key == $total_c2 )
                $out .= " selected";
            $out .= ">$value</option>";
    }
    $out .= '</select>';
    $out .= '</td></form></tr>';

    $out .= "</table>\n";


    $out .= '<table cellpadding=0 cellspacing=0 class=text>';
    $out .= "<tr><td height=2><img src=$site[images]spacer.gif height=2></td></tr>\n";
    $out .= "<tr><td width=17><img width=17 height=14 src=$site[images]/group2.gif></td><td width=100%><b>&nbsp;"._t("_Total Registered")."</b></td></tr>\n";
    
    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src=$site[images]us6.gif></td><td width=100%>&nbsp;"._t("_Total")." - $total_arr[0]</td></tr>\n";

	if ( !$no_cart )
    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src=$site[images]us4.gif></td><td width=100%>&nbsp;"._t("_Gold Members")." - $total_arr_gold[0] </td></tr>\n";

    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src=$site[images]us7.gif></td><td width=100%>&nbsp;"._t("_New this week")." - $total_arr_week[0] </td></tr>\n";
    $out .= "<tr><td width=17 align='right'><img width=17 height=14 src=$site[images]us1.gif></td><td width=100%>&nbsp;$total_c_members "._t("_members")." "._t("_from").":</td></tr>\n";
    $out .= '<form action="'.$_SERVER[PHP_SELF].'" method=post name="cForm"><tr><td align=right colspan=2>';
    $out .= "<input type=hidden name=total_c2 value=$total_c2>";
    $out .= '<select class=index name=total_c onChange="javascript: document.forms[''cForm''].submit();">';
    foreach ( $c_arr as $key => $value )
    {
            $out .= "<option value=$key";
            if ( $key == $total_c )
                $out .= " selected";
            $out .= ">$value</option>";
    }
    $out .= '</select>';
    $out .= '</td></form></tr>';

    $out .= '</table>';
    $out .= '</td></tr></table>';

    return DesignBoxContent ( _t("Members"), $w, $out, $h );
}
PLEASE HELP!!! I'm really stuck and that space is very annoying! Haha. Thanks!
Weirdan | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

what's the value of $h ?
Jonelle
Forum Newbie
Posts: 18
Joined: Sat Sep 11, 2004 8:08 pm

Post by Jonelle »

I have no idea ... but here's the code before that ....

Code: Select all

require_once( "inc/header.inc.php" );
require_once( "$dir[inc]design.inc.php" );
require_once( "$dir[inc]db.inc.php" );
require_once( "$dir[inc]admin.inc.php" );
require_once( "$dir[inc]profiles.inc.php" );
require_once( "$dir[inc]members.inc.php" );

// --------------- page variables

$_page['name_index'] = 1;
$_page['header'] = $site['title'];
$_page['header_text'] = $site['title'];

// --------------- GET/POST actions

// add email to notify emails list
if ( $_POST[subscribe] ) 
{
	AddNotifyEmail($_POST[subscribe]);
}

// --------------- [END] GET/POST actions

// rotating images
$rotate_index = rand(1,8);

// --------------- page components

$_ni = $_page['name_index'];

// show profile like search results
// posible values
// online: show online members
// rand: show randomize members
// last: show last registered members
// top: show top rated members
$index_search_results = getParam('index_search_results');
$_page_cont[$_ni]['like_search_result'] = LikeSearchResult($index_search_results);

$_page_cont[$_ni]['members_statistic'] = PageCompMemberStat($index_memberstat_w,$index_memberstat_h);
$_page_cont[$_ni]['top_rated'] = PageCompTopRated($index_toprated_w,$index_toprated_h);
$_page_cont[$_ni]['news_letters'] = PageCompNewsLetters($index_newsletters_w,$index_newsletters_h);
$_page_cont[$_ni]['success_story'] = PageCompSuccessStory($index_feedback_w,$index_feedback_h);
$_page_cont[$_ni]['latest_news'] = PageCompNews($index_latestnews_w,$index_latestnews_h);
$_page_cont[$_ni]['survey'] = PageCompSurvey($index_survey_w,$index_survey_h);
$_page_cont[$_ni]['featured_members'] = PageCompFeatured($featured_vertical);
$_page_cont[$_ni]['featured_members_title'] = _t("_featured members");
$_page_cont[$_ni]['search'] = PageCompSearch();
$_page_cont[$_ni]['search2'] = PageCompSearch2();
$_page_cont[$_ni]['quick_search2'] = DesignQuickSearch2();
$_page_cont[$_ni]['quick_search3'] = DesignQuickSearch3();

$_page_cont[$_ni]['quick_search_text'] = _t("_Quick Search");
$_page_cont[$_ni]['login_submit'] = _t("_Log In");
$_page_cont[$_ni]['login'] = _t("_E-mail or ID");
$_page_cont[$_ni]['passwd'] = _t("_Password");
$_page_cont[$_ni]['login_header'] = _t("_Member Login");
$_page_cont[$_ni]['MEMBER_LOGIN'] = strtoupper(_t("_Member Login"));
$_page_cont[$_ni]['homepage_text'] = _t("_homepage_text");
$_page_cont[$_ni]['homepage_promo0'] = _t("_homepage_promo0");
$_page_cont[$_ni]['homepage_promo1'] = _t("_homepage_promo1");
$_page_cont[$_ni]['homepage_promo2'] = _t("_homepage_promo2");
$_page_cont[$_ni]['homepage_promo3'] = _t("_homepage_promo3");
$_page_cont[$_ni]['homepage_promo4'] = _t("_homepage_promo4");

$_page_cont[$_ni]['promo_text_ae3_1'] = _t("_promo_text_ae3_1");
$_page_cont[$_ni]['promo_text_ae3_2'] = _t("_promo_text_ae3_2");
$_page_cont[$_ni]['promo_ae3_0'] = _t("_promo_ae3_0");
$_page_cont[$_ni]['promo_ae3_1'] = _t("_promo_ae3_1");
$_page_cont[$_ni]['promo_ae3_2'] = _t("_promo_ae3_2");
$_page_cont[$_ni]['promo_ae3_3'] = _t("_promo_ae3_3");
$_page_cont[$_ni]['promo_ae3_4'] = _t("_promo_ae3_4");
$_page_cont[$_ni]['promo_ae3_5'] = _t("_promo_ae3_5");
$_page_cont[$_ni]['promo_ae3_6'] = _t("_promo_ae3_6");
$_page_cont[$_ni]['promo_ae3_7'] = _t("_promo_ae3_7");

$_page_cont[$_ni]['promo_ae4_0'] = _t("_promo_ae4_0");
$_page_cont[$_ni]['promo_ae4_1'] = _t("_promo_ae4_1");
$_page_cont[$_ni]['promo_ae4_2'] = _t("_promo_ae4_2");
$_page_cont[$_ni]['promo_ae4_3'] = _t("_promo_ae4_3");
$_page_cont[$_ni]['promo_ae4_4'] = _t("_promo_ae4_4");
$_page_cont[$_ni]['promo_ae4_5'] = _t("_promo_ae4_5");
$_page_cont[$_ni]['promo_ae4_6'] = _t("_promo_ae4_6");
$_page_cont[$_ni]['promo_ae4_7'] = _t("_promo_ae4_7");
$_page_cont[$_ni]['promo_ae4_8'] = _t("_promo_ae4_8");
$_page_cont[$_ni]['promo_ae4_9'] = _t("_promo_ae4_9");


$row_spacer = "<table cellspacing=0 cellpadding=0 height=10><td><img src="".$site['images']."spacer.gif"></td></table>";
$_page_cont[$_ni]['row_spacer'] = $row_spacer;

// rotating images
$_page_cont[$_ni][' background="images/big1.jpg" '] = " background="images/big$rotate_index.jpg" ";

// --------------- [END] page components

PageCode();

// --------------- page components functions

/**
 * members statistic block
 */
function PageCompMemberStat( $w, $h)
{
	global $site;
	global $prof;

	$no_cart = getParam("no_cart") == "on" ? 1 : 0;
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

I believe $h arg to DesignBoxContent holds height of the outer box (which makes that box to be 320px in height). Try changing it to some smaller value. Alternatively, you can change CSS: add height:auto to .text class (it can break your page somewhere else though).
Post Reply