Tema: "Leer más"
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/07/2012, 20:12
furoya
(Desactivado)
 
Fecha de Ingreso: noviembre-2002
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 2.367
Antigüedad: 21 años, 7 meses
Puntos: 317
Respuesta: "Leer más"

Es que ni siquiera hay que usar funciones. Eso se hace con CSS.

Hace mil años se trató el asunto, pero en aquella época había que usar javascript, porque PHP corta según la cantidad de caracteres, y no sabe cuánto miden en la máquina cliente.

Enlaces largos

Pero al código hay que hacerle algunos ajustes.
Para no reabrir ese tema, pongo el ejemplo acá.

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<style type="text/css">

a {display: block; margin-top: 2em; }

a:link {width: 120px; height: 2em; border: 2px solid black; color: blue; 
overflow: hidden; text-overflow: ellipsis; }

a:visited {width: 120px; height: 2em; border: 2px solid black; color: blue; 
overflow: hidden; text-overflow: ellipsis; }

a:hover {width: auto; height: 2em; border: 2px solid black; color: red; }

a:active {width: auto; height: 2em; border: 2px solid black; color: green; }

</style>
</head>
<body>

<a
href="http://www.forosdelweb.com/" target="_blank" 
title="Enlace_muy_pero_muy_largo_a_los_Foros_del_Web.
http://www.forosdelweb.com/">
Enlace_muy_pero_muy_largo_a_los_<strong>Foros_del_Web</strong>.
</a>

<a
href="http://www.forosdelweb.com/" target="_blank" 
title="Enlace_muy_pero_muy_largo_a_los_Foros_del_Web.
http://www.forosdelweb.com/">
Enlace_muy_pero_muy_largo_a_los_<strong>Foros_del_Web</strong>.
</a> </body>
</html>
Está en enlaces, tú tienes que usarlo en títulos. Y muestra los puntos suspensivos.