[#] Skracanie adresu url w Drupal

( Ostatnio zmieniony ndz., 29/06/2008 - 01:53 )
 

PHP

<?php
function _filter_url_trim($text, $length = NULL) {
  static $_length;
  if ($length !== NULL) {
    $_length = $length;
  }

  // Use +3 for '...' string length.
  if (strlen($text) > $_length + 3) {
    $text = substr($text, 0, $_length) .'...';
  }

  return $text;
}
?>

DRUPAL

l(_filter_url_trim($data->url,40),$data->url)
5
Twoja ocena: Brak Średnio: 5 (2 głosy)