Print random part of body I'd like to print (in Views - custom/PHP field) random part of body of a node, as a kind of teaser, different with every print.

Any ideas? Thanks! :]

Szy.
here you go: :)

$length = 50;

// strip html tags from body
$body = strip_tags($data-&gt;body);

// check that the body's actually longer than your snippet length
if (strlen($body) &lt;= $length) {
  return $body;
}
else {

  // find a random starting point between the beginning and 50 chars from the end
  $max = strlen($body) - $length;
  $start = rand(0, $max);

  // set ellipsis variables
  $prefix = $start ? '...' : '';
  $suffix = ($start == $max) ? '' : '...';

  return $prefix . substr($body, $start, $length) . $suffix;
}