From 7415f47c01a726c39d6a7c4f7da317a236b6644b Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Tue, 25 Jul 2017 17:54:44 +0200 Subject: [PATCH] Fix trim stringhe html Signed-off-by: Riccardo Di Dato --- public/categorySummary.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/categorySummary.php b/public/categorySummary.php index 3e05236..02599db 100644 --- a/public/categorySummary.php +++ b/public/categorySummary.php @@ -64,9 +64,12 @@ try{ if(sizeof($notizie)>0){ foreach ($notizie as $notizia){ $i++; - $stringTitolo = (strlen($notizia->titolo) > 103) ? substr($notizia->titolo,0,100).'...' : $notizia->titolo; - $stringSottotitolo = (strlen($notizia->sottotitolo) > 73) ? substr($notizia->sottotitolo,0,70).'...' : $notizia->sottotitolo; - $stringTesto = (strlen($notizia->testo) > 33) ? substr($notizia->testo,0,30).'...' : $notizia->testo; +// $stringTitolo = (strlen($notizia->titolo) > 103) ? substr($notizia->titolo,0,100).'...' : $notizia->titolo; +// $stringSottotitolo = (strlen($notizia->sottotitolo) > 73) ? substr($notizia->sottotitolo,0,70).'...' : $notizia->sottotitolo; +// $stringTesto = (strlen($notizia->testo) > 33) ? substr($notizia->testo,0,30).'...' : $notizia->testo; + $stringTitolo = (strlen($notizia->titolo) > 103) ? htmlentities( substr( html_entity_decode( $notizia->titolo, ENT_QUOTES|ENT_HTML5 ),0,100) ).'...' : $notizia->titolo; + $stringSottotitolo = (strlen($notizia->sottotitolo) > 73) ? htmlentities( substr( html_entity_decode( $notizia->sottotitolo, ENT_QUOTES|ENT_HTML5 ) ,0,70) ).'...' : $notizia->sottotitolo; + $stringTesto = (strlen($notizia->testo) > 33) ? htmlentities( substr( html_entity_decode( $notizia->testo, ENT_QUOTES|ENT_HTML5 ),0,30) ).'...' : $notizia->testo; $media = DaoMediaHandler::getMainMediaFromModel($notizia); ?>