SimplePortal

Support => International Support => Spanish => Topic started by: Jisana on January 01, 2011, 02:34:50 PM

Title: [Condicion] Leer Mas
Post by: Jisana on January 01, 2011, 02:34:50 PM
Hola, buenas tardes y feliz año nuevo :D
Antes que nada pedir disculpas si mi problema ya está escrito, he buscado por el foro y google y no he encontrado nada.

Llevo toda la tarde pegando con el código y sin solucionar nada de nada. Veréis os comento, yo en simple portal tengo establecido que la longitud de la noticia sea de 300carácteres y tengo noticias que ocupan más y otras que ocupan menos.

Siempre aparecen los dichosos tres puntos "..." aunque sea una noticia sin cortar y también el botón "Leer mas"
Estoy toda la tarde toqueteando portalArticles.php y no he conseguido hacer absolutamente nada, bueno sí (poner una imagen en vez de que salga Escribir Comentario) XD

¿Porfavor, alguien me podría ayudar a editar el archivo.php?
A mi lo que me gustaría es que si la noticia se corta, sí que aparezca "Leer más", en cambio si NO se corta que desaparezca.

Creo que la linea exacta a editar es esta (sacada de portalarticles.php)
Quote
'link' =>  '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $txt['sp-read_more'] . '</a>',

Muchas gracias adelantadas.
Title: Re: [Condicion] Leer Mas
Post by: Jisana on January 01, 2011, 02:42:49 PM
jaja a veces como son las cosas... te viene la inspiración y lo sacas :D

Voy a hacer un tutorial para quien quiera :D

Buscar

Quote
'link' =>  '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $txt['sp-read_more'] . '</a>',


Reemplazar por:
Quote
'link' =>  !empty($modSettings['articlelength']) && $func['strlen']($row['body']) < $modSettings['articlelength'] ? '' : '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $txt['sp-read_more'] . '</a>',

De este modo todos, todos los artículos cortados tendrán el botón Leer más.

Ahora voy a investigar los tres puntos... XD
Title: Re: [Condicion] Leer Mas
Post by: 130860 on January 01, 2011, 02:44:02 PM
en tu archivo /Sources/PoratlArticles encuentra esto:


Code: [Select]
// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';



y reemplazalo con esto:

Code: [Select]
// Only place an ellipsis if the body has been shortened.
if ($limited == true)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
Title: Re: [Condicion] Leer Mas
Post by: Jisana on January 01, 2011, 03:05:29 PM
Muchas gracias por responder tan rápido, pero no ha sido tan fácil.
Estoy modificando todo el rato ese archivo y no he visto nada de $limited. Mira yo tengo esto:

Code: [Select]
if (($cutoff = $func['strpos']($row['body'], '')) !== false){
//Aquí se corta la noticia

$row['body'] = $func['substr']($row['body'], 0, $cutoff);
}

else if (!empty($modSettings['articlelength']) && $func['strlen']($row['body']) > $modSettings['articlelength']){
//Aquí es cuando NO se corta la noticia
$row['body'] = $func['substr']($row['body'], 0, $modSettings['articlelength']);
}


$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MESSAGE']) . '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" title="' . $row['subject'] . '">...</a>';

Si quito sólo los tres puntos desaparece para todas las noticias.
Title: Re: [Condicion] Leer Mas
Post by: 130860 on January 01, 2011, 03:33:37 PM
ok, adjunta tu archivo Sources/PortalArticles.php
Title: Re: [Condicion] Leer Mas
Post by: Jisana on January 01, 2011, 04:17:27 PM
Aquí lo tienes ^^
Title: Re: [Condicion] Leer Mas
Post by: 130860 on January 01, 2011, 04:54:30 PM
usa este
Title: Re: [Condicion] Leer Mas
Post by: Jisana on January 02, 2011, 06:17:39 AM
Bueno... he podido llegar a hacer lo que quiero pero no me ha servido el código, pero muchas gracias :D

Te copio y pego el código :D

Code: [Select]
       //Aquí no se que se comprueba, pero algo hace XD
         if (($cutoff = $func['strpos']($row['body'], '')) !== false){
$row['body'] = $func['substr']($row['body'], 0, $cutoff);
}

else if (!empty($modSettings['articlelength']) && $func['strlen']($row['body']) > $modSettings['articlelength']){
//Aquí es cuando SI se corta la noticia
//Montamos la estructura de la noticia con "Seguir Leyendo"
$row['body'] = $func['substr']($row['body'], 0, $modSettings['articlelength']);
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MESSAGE']).'<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" title="' . $row['subject'] . '">seguir leyendo</a>';
}
       
        //Como no ha entrado en el if, se crea la estructura sin el seguir leyendo :D
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MESSAGE']);
Title: Re: [Condicion] Leer Mas
Post by: kizaru74 on November 16, 2011, 02:03:59 PM
a mi no me funciona el leer mas... me sigue saliendo por mas que lo intento

cheqenlo esta es mi web: evowarez.nixiweb.com
SimplePortal 2.3.8 © 2008-2024, SimplePortal