Web サイトからの RSS フィードを解析してページに投稿する Web サイトがあります。
RSS フィードを読み取って再フォーマットする、私の Web サイトの背後で実行されるスクリプトは、現在、すべての HTML タグを削除しています。
コードは次のとおりです。や
$description = strip_tags($description);
のようなタグを許可したい<p>
のですが、そうするとなぜかサイトがめちゃくちゃになってしまいます。ヘッダーのように、その上に大きなスペースがあります。
それに対する解決策は何でしょうか?<a>
<br />
===編集===(いくつかのコード)
// get all of the sources of news from the database
$get_sources = $db->query("SELECT * FROM ".$prefix."sources ORDER BY last_crawled ASC");
while ($source = $db->fetch_array($get_sources)) {
$feed = new SimplePie($source[url]);
$feed->handle_content_type();
foreach ($feed->get_items() as $item)
{
$title = $item->get_title();
$link = $item->get_link();
$description = $item->get_content();
// strip all html
$description = strip_tags($description);
// format the data to make sure it's all fine
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
// create the path, or slug if you will
$path = post_slug($title);
$description = html_entity_decode($description, ENT_QUOTES, 'UTF-8');