Jump to content


Limiting the size of the result


4 replies to this topic

#1 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 29 November 2005 - 10:52 AM

Ok I am doing a lil message system for a project. And when you visit the main page where all the messages are displayed, i want to limit one of the fields displayed so that the page doesnt stech and mess up.

If you are not sure i will add a screenshot in about an hour when i am home

thanks

#2 Ruben K

    Cliff

  • Twodded Staff
  • PipPip
  • 438 posts

Posted 29 November 2005 - 11:21 AM

What do you mean limit? Cut-off the message or make it go to a new line after several chars?

#3 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 29 November 2005 - 11:52 AM

yea cut of the message say after 30 characters so they can get a preview of the msg

#4 Ruben K

    Cliff

  • Twodded Staff
  • PipPip
  • 438 posts

Posted 29 November 2005 - 02:11 PM

Try this function:

<?php
function cut_off( $txt )
{
	$txt = substr( $txt, 0, 30 );
	$txt .= '...';

	return $txt;
}
?>

:)

#5 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 29 November 2005 - 02:56 PM

ah thanks mate :) :)

had to play around with it a lil to get it to fully work with wht i am doing but still works great

cheeres





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users