HTML in PHP Code

  • HTML in PHP Code

    Hallo, es geht um folgenden Code (Der liest RSS aus und gibt es dann hal via PHP aus):

    Quellcode

    1. <?
    2. $quelle = @file('www.bla.de');
    3. $data = implode ("", $quelle);
    4. if(isUTF8($data)) $utf8 = 1;
    5. else $utf8 = 0;
    6. preg_match_all("|<item>(.*)</item>|Uism",$data, $items, PREG_PATTERN_ORDER);
    7. if (count($items[1])==0) {
    8. preg_match_all("|<item .*>(.*)</item>|Uism",$data, $items, PREG_PATTERN_ORDER);
    9. }
    10. for ($i=0; $i<count($items[1]); $i++) {
    11. preg_match_all("|<title>(.*)</title>(.*)<link>(.*)</link>|Uism",$items[1][$i], $regs, PREG_PATTERN_ORDER);
    12. if($utf8 == 1) $title = utf8_decode($regs[1][0]);
    13. else $title = $regs[1][0];
    14. echo "<a href=\"".$regs[3][0]."\" target=\"_blank\">".$title."</a><br>\n";
    15. }
    16. function isUTF8($str) {
    17. if ($str === mb_convert_encoding(mb_convert_encoding($str, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
    18. return true;
    19. } else {
    20. return false;
    21. }
    22. }
    23. ?>
    Alles anzeigen


    Genauer genommen geht es um die Zeile 17:

    Quellcode

    1. echo "<a href=\"".$regs[3][0]."\" target=\"_blank\">".$title."</a><br>\n";

    Ich möchte nämlich ein Div Container um einen Titel packen! Wo muss ich den DIV Container hin packen (Anfang, Ende)?
    Habe es so probiert:

    Quellcode

    1. echo "<div id="item"><a href=\"".$regs[3][0]."\" target=\"_blank\">".$title."</a></div><br>\n";

    Da durch bekomme ich aber einen White Screen :(

    Ich hoffe auf Hilfe :)

    Mit freundlichen Grüßen,
    Jörgen K.