PDA

View Full Version : Truncating a User Profile Field


imageconstrux
02-19-2003, 06:29 PM
I've created a few new user profile fields for my board, and am using the Radio Button/Drop Down hack to select choices.

One of the fields, for people to understand what info I'm looking for (and help them choose), I have to use about 30 characters for each choice.

However, I also want to display this info in the Postbit Template, but the approx 30 characters makes for messy viewing - I want to truncate that 7 characters.

I've been told that it would have to be hacked/hardcoded -

Anybody have an idea of how one might go about making this hack, to truncate that field when being displayed in the postbit template?

Thanks,

Jeff

Sebastian
02-19-2003, 07:16 PM
this will truncate it with a "..."

change the 7 to the amount of characters you want to appear ...


if(strlen($post[fieldx]) > 7 ) {
$post[fieldx] = substr(trim($post[fieldx]),0,7);
$post[fieldx] = $post[fieldx].'...';


change the X to your custom profile ID..

What hack are you using to create radio button and drop down list?