Good morning,
I have some saved articles in a database, where all the tags appear so that when you download it with PHP you can load all the elements,
...
The fact is that a preview of the article I just want it to be plain text. I have tried 2 options but none of them gives me the result I want:
echo "<p>" . htmlspecialchars(substr($articulos[$i]['articulo'], 0, 300)) . "...</p>";
In this case, it returns all the text in the database with the tags, without converting the text to HTML code.
echo "<p>" . substr($articulos[$i]['articulo'], 0, 300) . "...</p>";
In this other case it converts the HTML tags, but if there are tags at the beginning of the article, they appear and distort everything ...
The only thing I can think of is that the first 300 characters of the articles are text with the tag
, but I would like to know if there is any way to save this problem.