It is necessary to display the first image of the article for previews - a picture and a little text.
For example, the body of the article:
<img src="files/1.jpg" alt="" width="200px" /> <img src="files/2.jpg" alt="" width="200px" /> <img src="files/3.jpg" alt="" width="200px" /> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> Here is the code that lists the thumbnails of the articles:
while ($row = $results->fetchArray()) { echo 'id: ' . $row['id'] . '<br /> Дата и время: ' . $row['datetime'] . '<br /> Заголовок: ' . $row['title'] . '<br /> Категория: <a href="?category=' . $row['category'] . '">' . $row['category'] . '</a><br /> Контент: ' . mb_strimwidth($row['content'], 0, 300, '...') . '<br /> <a href="?article=' . $row['id'] . '">Читать</a> <br />-------------------------------------------------<br />'; } Help, kind people realize this thing!
In general, it is necessary to finish the regular book in such a way that it also displays the first available text up to 300 characters. And in regular expressions, I understand extremely tight :)