Jump to content

[SOLVED] display large field value


isaac_cm

Recommended Posts

This is what you do... Put this function at the top of the page:

 

function Shorten($words) {
//change this to whatever you want the length (in characters) to be...
$newlength=15;
$newwords=substr($words, 0, $newlength);
$newwords=$newwords."...";
return $newwords;
}

 

Then whenever you want to shorten a string of text, put call the function then display the link or whatever with the shortened text as $newwords, and the original string will still be $string or whatever variable it was in before...

 

Shorten($string);
<a href="http://this.link" title="$string">$newwords</a>

 

Haven't tested it but should work fine!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.