Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente bannato
    Registrato dal
    Jun 2003
    Messaggi
    1,011

    title truncated , aggiungere i puntini alla fine

    Ho questo codice qui che mi tronca il titolo:

    Codice PHP:
     if ( $length && is_numeric($length) ) {
           
    $title substr$title0$length );
        } 

    Il punto è che vorrei aggiungere tre puntini nel caso mi troncasse il titolo, cosa che ora non fà...come posso fare ?

  2. #2
    Codice PHP:
    function stringTransform($str,$len) {
        if(
    strlen($str)>$len){
             
    $str substr$str0$len )."...";
        }
        return 
    $str;
    }
    echo 
    stringTransform("pippo",3); 
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.