Dizeden HTML etiketleri şerit

0 Cevap php

I have a website which parses RSS feed from websites and posts them on a page.
The script that runs behind my website, which reads and reformats the RSS feed, is currently stripping all the HTML tags.

Here's the code;
$description = strip_tags($description);

I want to allow tags like <p>, <a> or <br /> but if i do that, for some reason my website becomes a mess. Like the header will have a big space above it.
What would be the solution to that?

=== EDIT === (biraz daha fazla kod)

// 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');

0 Cevap