php – divide the editor text which have html attributes on every 500 th character length for creating text slider
Question
I have to create the text slider , but that text have html attributes also,so supposed i have 1000 char length of text including html attribute and if i am dividing the text on every 500 character the html div tag will also get divide and my text will look like an simple text ,is there any solution ,hope you guyz get understand what im trying to do
$msg = $message;
$xyz = strip_tags($msg);
$lentgh = strlen($xyz);
$noOfDiv = round($lentgh/500);
for($i = 1 ; $i <= $noOfDiv ;$i++){
$startPoint = $prevPoint;
$endPoint = $startPoint + 500;
$prevPoint = $endPoint;
$abc = substr($msg, $startPoint, $endPoint);
echo "<div class="mySlides ">
<div class="numbertext">".$i." / ".$noOfDiv."</div>
<div class="message__text__container">
<div class="text"> ".$abc."</div>
</div>
</div>";
}
0
2 years
2021-04-13T09:39:39-05:00
2021-04-13T09:39:39-05:00 0 Answers
0 views
0
Leave an answer