2017-12-01 7 views
0

Also, was ist das Problem mit diesem Code? $ Inhalt hat Text mit HTML-Tags, aber wenn ich etwas poste, funktionieren die Tags nicht und werden als reiner Text angezeigt.Text erscheint mit Tags

<?php 
     require_once("nbbc/nbbc.php"); 
     $bbcode = new BBCode; 
     $sql = "SELECT * FROM posts ORDER BY id DESC"; 
     $res = mysqli_query($db, $sql) or die(mysqli_connect_error()); 
     $posts = ""; 
     if (mysqli_num_rows($res) > 0){ 
      while($row = mysqli_fetch_assoc($res)) { 
       $id = $row['id']; 
       $title = $row['title']; 
       $content = $row['content']; 
       $date = $row['date']; 

       $output = $bbcode->Parse($content); 
        if (strlen($output) > 1000) { 
         $stringCut = substr($output, 0, 1000); 
         $output = substr($stringCut, 0, strrpos($stringCut, ' '))." ... <a href='view_post.php?pid=$id'>Lasīt Vairāk</a>"; 
        } 
       $posts .="<div><h1 style='margin-left:0'><a href='view_post.php?pid=$id'>$title</a></h1><p style='margin:3px; font-style:italic; opacity: 0.6;'>$date<p><p>$output</p></div><hr>"; 
      } 
      echo $posts; 
     } else { 
      echo "Oops, no new posts"; 
     } 

    ?> 
+1

Können Sie zeigen ein Beispiel für die Ausgabe zu demonstrieren, was falsch läuft? – showdev

+1

Sie haben HTML-Tags hinzugefügt. Warum sollten sie nicht erscheinen? –

+0

Haben Sie HTML-Root-Element? –

Antwort