I have PHP code which fetches the articles from a database. The fetching works fine and i get the list of the articles
I needed to truncate the contents of each article so it fits inside the space. But i couldnt figure out a way to write. Below is the necessary code which needs to be corrected.. For better understanding i have included only the necessary parts inside while loop.
while( ($row = mysqli_fetch_assoc($result)))
{
echo" <article id='post-31' class='post-31 post type-post status-publish format-aside hentry category-news blogitem'>
<div class='blogitem-container'>
<div class='meta-container'>
<div class='rb_blog_meta_date_wrapper'>
<div class='rb_blog_meta_date rb_format_aside'><span class='rb_blog_meta_date_day'>02</span> JAN</div>
</div>
<div class='rb_meta_links '>
<h3><a href='video-postformat.html'>".$row['title']."</a></h3>
<hr>
<i class='fa fa-folder'></i> <a href='#' title='View all posts in News' rel='category tag'>".$row['category']."</a> <i class='fa fa-heart bloglike '></i> <a class='bloglikelink' href='#' data-post-id='31'>".$row['like']."</a>
</div>
<!-- .rb_meta_links -->
<div class='clearfix'></div>
</div>
<!-- .meta-container -->
<div class='blogtext' >
<p align='justify'>'".mb_strimwidth('.$row['content'].', 0, 100, '...')."'
</p>
</div>
<!-- .blogtext -->
<a class='blogreadmore' href='video-postformat.html' >Read More</a>
<div class='clearfix'></div>
</div>
<!-- .blogitem-container -->
</article>";
}
?>
Can somebody rewrite the echo tag so it works. I am a Beginner Programmer. Edited the Question. Included the whole code.
<p align='justify'>'".mb_strimwidth('.$row['content'].', 0, 100, '...')."'
</p>.
Need this piece of code corrected
Original question, so as not to confuse others looking at answers:
while( ($row = mysqli_fetch_assoc($result))){
echo "mb_strimwidth("'.$row['content'].'", 0, 10, "...");";
}
You're using way too many quotes where you shouldn't at all
Here