I know everybody knows how todo it, but cutting text according to text length is needed almost in any content driven website to avoid breaking design. here is my handy function for cutting text:

function wordcutter($string , $cutnum) {

$wordcutter = strlen($string);

if ($wordcutter > $cutnum) {

$titlecut = substr($string, 0, $cutnum);
$titlecut .= ‘…’;

echo $titlecut;
} else {

echo $string;

}
}


del.icio.us:Cutting text , handy php function digg:Cutting text , handy php function newsvine:Cutting text , handy php function fark:Cutting text , handy php function

SPEAK / ADD YOUR COMMENT
Comments are moderated.

Return to Top

Cutting text , handy php function

FRESH / LATEST POSTS

My Mobbroll



www.flickr.com

Tags


apple ,  asi dayan ,  auction ,  bill gates ,  bizwise ,  Bugile ,  bukaa ,  cloverfield ,  code ,  death ,  Deface ,  design ,  develop ,  digg ,  Disc review ,  domains ,  fashion ,  firefox ,  first timer ,  funny ,  geek ,  General ,  gizmos ,  gmail ,  google ,  great service ,  hackers ,  icq ,  idf pizza ,  instant messenger ,  israel ,  jj abrams ,  life ,  linux ,  metalist ,  microsoft ,  model ,  movie ,  music ,  negotiation ,  New start? ,  news ,  Nokia ,  nuclear ,  oron ,  peace ,  phising ,  poor ,  pub ,  review ,  security ,  selling ,  service ,  social ,  software ,  spam ,  ssl ,  starwars ,  stupid ,  terrorist ,  toaster abuse ,  tshirt hell ,  ubuntu ,  usability ,  useless id ,  web 2.0 ,  web savvy ,  Yeah right ,  zoho ,