22/02/2013, 22:25
|
| | Fecha de Ingreso: enero-2013
Mensajes: 38
Antigüedad: 12 años Puntos: 0 | |
Respuesta: limitar texto a mostrar de mysql intente hacerlo.. pero no me sale nada.. este es el codigo que tengo.
<?php
include('acceso_db.php');
function the_content_limit($texto, $limite) {
return (strlen($texto)>$limite) ? substr($texto, 0, $limite) . '...' : $texto;
}
$result = mysql_query("SELECT * FROM wp_posts WHERE post_type= 'post' and post_status= 'publish' ORDER BY ID DESC LIMIT 3 ");
while($row = mysql_fetch_array($result))
{?>
<label><a href="<?=$row['guid']?>" title="<?=$row['post_title']?>" target="_blank"><?=$row["post_title"]?></a></label></br>
<?php the_content_limit($row['post_content'], 100);?>
<?php } ?> |