Jump to content


Photo

site error


  • Please log in to reply
6 replies to this topic

#1 fullyloaded

fullyloaded
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 October 2006 - 04:58 PM

hi
i have a small problem on my sites home page i have a dating website with 3 newest members on the front page my problem is when the 3 newest members usernames are to long it will split my image apart is there anyway you can fix this so if there username is long it will only show part of there username and not split the image on the site? here is the site you can see the problem there on the main page http://www.singlespleasures.com thanks...

#2 dymon

dymon
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 15 October 2006 - 05:29 PM

Hi,

you can use substr function:

string substr ( string string, int start [, int length] )

And of you want to show only a part of the user name you can make like this:

$username = substr($username, 1, 15);

Hope this is what you ment.

Web is the future ... desktop will die ...

#3 fullyloaded

fullyloaded
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 October 2006 - 05:42 PM

hi dymon
thanks can you tell me where to put this code? $username = substr($username, 1, 15); here is the code for the main page of my site the usernames would be this in the code "NM_NAME"    =>        $dbu->f('username'),
<?php


$dbu=new mysql_db;

$ft=new ft(ADMIN_PATH.MODULE."templates/");
$ft->define(array('main' => "home.html"));
$ft->define_dynamic('member_row','main');

//*************Quick Search Form***********************
if($_SESSION['photo'])
{
	$checked='checked';
}
	
if($_SESSION['st_online'])
{
	$checked2='checked';
}	
	
$ft->assign(array(
                   "COUNTRY"         =>        build_country_list($_SESSION['country']),
                   "S_G"             =>        build_gender_list($_SESSION['s_g']),
                   "SSY" 			 =>		   build_numbers_list(LOWEST_AGE, HIGHEST_AGE,$_SESSION['ssy']),
                   "ESY"   			 =>		   build_numbers_list(LOWEST_AGE, HIGHEST_AGE,$_SESSION['esy']),
                   "CHECKED"   		 =>		   $checked,
                   "CHECKED2"   	 =>		   $checked2,
                 )
			);

$dbu->query('SELECT COUNT(*) AS rowcount FROM member'); 
    $dbu->move_next(); 
    $ft->assign('MEMBER', $dbu->f('rowcount')); 
     
$ft->assign("V_NO", $i);
	
    $time_stamp = mktime ( date("H"), date("i")-ONLINE_TIMEOUT, date("s"), date("m"), date("d"), date("Y") );
    
	$dbu->query("SELECT COUNT(*) AS maxrows FROM member WHERE action >= '".$time_stamp."'");
	$dbu->move_next();
	$ft->assign("ONLINE_NO", $dbu->f('maxrows') );
//****************Fast Facts***************************
$dbu->query("select count(member_id) as num_rec from member where active1='1' AND active2='1' AND visible='2'");
$dbu->move_next();
$total_profiles=$dbu->f('num_rec');

$dbu->query("select count(member_id) as num_rec from member where gender = 'Man' AND active1='1' AND active2='1' AND visible='2'");
$dbu->move_next();
$man_profiles=$dbu->f('num_rec');

$dbu->query("select count(member_id) as num_rec from member where gender = 'Woman' AND active1='1' AND active2='1' AND visible='2'");
$dbu->move_next();
$woman_profiles=$dbu->f('num_rec');
$ft->assign(array(
                  "TOTAL_PROFILES"    	 =>        $total_profiles,
                  "MEN_PROFILES"     	 =>        number_format((( $man_profiles * 100 ) / $total_profiles )),
                  "WOMEN_PROFILES"     	 =>        number_format((( $woman_profiles * 100 ) / $total_profiles )),
                 )
           );


//*********get most viewed man*****************
$dbu->query("select username, member_id, birthdate, picture, thumb, country from member where gender = 'Man' order by viewed DESC limit 0,2");
$dbu->move_next();
list($b_year,$b_month,$b_day )=split("-",$dbu->f('birthdate'));
$ft->assign(array(
                  "MP_MAN_NAME"    		 =>        $dbu->f('username'),
                  "MP_MAN_LOCATION"    =>        $dbu->f('country'),
                  "MP_MAN_AGE"     		 =>        get_age($b_month,$b_day,$b_year),
                  "MP_MAN_VIEW"     	 =>        'member/index.php?pag=member_profile&member_id='.$dbu->f('member_id'),
                 )
           );
if($dbu->f('thumb'))
{
	$ft->assign('MP_MAN_IMAGE', $script_path.UPLOAD_PATH.$dbu->f('thumb'));
}
else 
{
	$ft->assign('MP_MAN_IMAGE', $script_path.'img/na_small.gif');
}

//*********get most viewed woman*****************
$dbu->query("select username, member_id, birthdate, picture, thumb, country from member where gender = 'Woman' order by viewed DESC limit 0,2");
$dbu->move_next();
list($b_year,$b_month,$b_day )=split("-",$dbu->f('birthdate'));
$ft->assign(array(
                  "MP_WOMAN_NAME"    		 =>        $dbu->f('username'),
                  "MP_WOMAN_LOCATION"    =>        $dbu->f('country'),
                  "MP_WOMAN_AGE"     		 =>        get_age($b_month,$b_day,$b_year),
                  "MP_WOMAN_VIEW"     	 =>        'member/index.php?pag=member_profile&member_id='.$dbu->f('member_id'),
                 )
           );
if($dbu->f('thumb'))
{
	$ft->assign('MP_WOMAN_IMAGE', $script_path.UPLOAD_PATH.$dbu->f('thumb'));
}
else 
{
	$ft->assign('MP_WOMAN_IMAGE', $script_path.'img/na_small.gif');
}

//*******get newest members*********************************
$dbu->query("SELECT member_id, username, birthdate, picture, thumb, gender FROM member WHERE active1='1' AND active2='1' AND visible='2' ORDER BY member_id DESC LIMIT 3");
while($dbu->move_next())
{
	list($b_year,$b_month,$b_day )=split("-",$dbu->f('birthdate'));
	$ft->assign(array(
	                  "NM_NAME"    		 =>        $dbu->f('username'),
	                  "NM_GENDER"    	 =>        $dbu->f('gender'),
	                  "NM_AGE"     		 =>        get_age($b_month,$b_day,$b_year),
	                  "NM_VIEW"     	 =>        'member/index.php?pag=member_profile&member_id='.$dbu->f('member_id'),
	                 )
	           );
	if($dbu->f('thumb'))
	{
		$ft->assign('NM_IMAGE', $script_path.UPLOAD_PATH.$dbu->f('thumb'));
	}
	else 
	{
		$ft->assign('NM_IMAGE', $script_path.'img/na_small.gif');
	}
	           
	$ft->parse('member_ROW_OUT','.member_row');         
}


$ft->assign('MESSAGE',$glob['error']);

$ft->parse('CONTENT','main');
//$ft->fastprint('CONTENT');
return $ft->fetch('CONTENT');

?>


#4 dymon

dymon
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 15 October 2006 - 05:52 PM

$ft->assign(array(
                  "NM_NAME"     =>        substr(1, 15, $dbu->f('username')),
                  "NM_GENDER"     =>        $dbu->f('gender'),
                  "NM_AGE"      =>        get_age($b_month,$b_day,$b_year),
                  "NM_VIEW"      =>        'member/index.php?pag=member_profile&member_id='.$dbu->f('member_id'),
                 )
           );

This should work ok.
Otherwise you can make this change in the HTML output, this should be in the $dbu or in $ft object.
Web is the future ... desktop will die ...

#5 fullyloaded

fullyloaded
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 October 2006 - 06:04 PM

hi
had no luck when i put the code in it removes the name and noting shows up  :'(

#6 dymon

dymon
  • Members
  • PipPipPip
  • Advanced Member
  • 79 posts

Posted 15 October 2006 - 06:12 PM

Hi,

sorry I made a small mistake in usage of the function:

"NM_NAME"    =>        substr($dbu->f('username'), 0, 15),
Web is the future ... desktop will die ...

#7 fullyloaded

fullyloaded
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 October 2006 - 06:17 PM

hi
thanks alot!! that one works  ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users