Advertisement
Syntafin

Untitled

Feb 21st, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. <?php header("Content-type: text/xml");
  2. echo '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'; ?>
  3. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  4.  
  5. <channel>
  6.     <title>Antribute.eu</title>                     // Feed Titel
  7.     <language>de</language>                                 // Language
  8.     <link>http://antribute.eu</link>                        // Adresse woher der Feed kommt
  9.     <description>Pay you Tribute to the Chaos ~ Next Generation beginn</description>    // Beschreibung des Feeds
  10.     <copyright>Copyright <?php date(y); ?> antribute.eu</copyright>     // Copyright
  11.  
  12. <?php
  13.  
  14. $host = "localhost"; // Adresse des Datenbankservers, fast immer localhost
  15. $user = "syntafin";          // Ihr MySQL Benutzername
  16. $pass = "*********";         // Ihr MySQL Passwort
  17. $dbase = "antribute";        // Name der Datenbank
  18.  
  19. $connection = mysql_connect("$host" , "$user" , "$pass") OR DIE ("Keine Verbindung zu der Datenbank moeglich.");
  20. $db = mysql_select_db($dbase , $connection) or die ("Auswahl der Datenbank nicht moeglich.");
  21.  
  22. // Datenbankabfrage
  23. $query = "SELECT id, autor, title, text, datum FROM blog ORDER BY id DESC LIMIT 0,5";    
  24. $result = mysql_query($query, $connection) or die (mysql_error());
  25.  
  26. // Ausgabe der Daten
  27. while ($row = mysql_fetch_array($result)){
  28.     $id = $row['id'];
  29.     $autor = $row['autor'];
  30.     $title = $row['title'];
  31.     $news = $row['text'];
  32.     $pubdate = strtotime($row['datum']);
  33.     $pubdate = date(r, $pubdate);  
  34. ?>
  35.     <item>
  36.         <title><?php echo $title; ?></title>
  37.         <link>http://antribute.eu/?p=blog&amp;mode=view&amp;id=<?php echo $id; ?></link>
  38.         <guid isPermaLink="false">http://antribute.eu/?p=blog&amp;mode=view&amp;id=<?php echo $id; ?></guid>
  39.         <author><?php echo $autor; ?></author>
  40.         <pubDate><?php echo $pubdate; ?></pubDate>
  41.         <description><![CDATA[ <?php echo $news; ?> ]]></description>
  42.     </item>
  43. <?php } /* close while*/ ?>
  44.  
  45. </channel>
  46. </rss>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement