php - Cutting text in between destroys the design -


i'm having issue website. count 150 words , cut displaying intro text on website produces issue.

when have in text:

<div> ////text text text text text//// ----> reach 150 words here <------ ////text text text text text//// </div> 

it print in front-page:

<div> ////text text text text text//// ----> reach 150 words here <------ 

and unclosed <div> tag destroys design expected.

how can overcome issue? can proccess unclosed tags , close them in end?

use php's strip_tags remove div copy, add in afterwards.

for example;

<?php $html = '<div>content goes here</div>'; $stripped = strip_tags($html); $excerpt_pos = strpos(' ', $stripped, 150); ?>  <div><?php echo substr($stripped, 0, $excerpt_pos); ?></div> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -