login  Naam:   Wachtwoord: 
Registreer je!
 Forum

XML - RSS

Offline Ken - 21/01/2006 17:32
Avatar van KenNieuw lid Ik ben XML en RSS LEEK!!

Ik heb dit: http://www.cyclingnews.be/nieuws.xml

en dit: http://www.cyclingnews.be/news.rss

hoe krijg ik alle informatie van die news.rss in de nieuws.xml???

Ik haal mijn news.rss via een newsfeed.php waardoor ik de laatste 3 berichtjes uit database in die xml-vorm giet (news.rss) maar dit moet bij nieuws.xml kunnen??

Nieuws.xml moet wel die bovenste tag blijven bewaren anders werkt flash-scriptje niet meer  

5 antwoorden

Gesponsorde links
Offline MothZone - 21/01/2006 17:34
Avatar van MothZone PHP ver gevorderde Open newsfeed.php en zoek daarin op "news.rss", en deze gewoon vervangen door "nieuws.xml".
Offline Ken - 21/01/2006 17:40 (laatste wijziging 21/01/2006 18:02)
Avatar van Ken Nieuw lid Dit MOET ook in de nieuws.xml komen en weet niet hoe:

<items license="Don't remove this paragraph, or your template will stop working. Amara Software owns the copyright to this template, which may not be sold or resold, in its original form or as part of another template, by anyone other than Amara Software. To check the full license restrictions, please refer to http://www.amar..."/>;

Bovenaan in newsfeed stoppen of hoe???

  1. <?php
  2.  
  3. ...
  4.  
  5. $_xml .= '<?xml version="1.0" ?>' . "\n";
  6. $_xml .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">' . "\n";
  7. $_xml .= '<channel>' . "\n";
  8. $_xml .= '<title>' . $_ttl . '</title>' . "\n";
  9. $_xml .= '<link>' . $_lnk . '</link>' . "\n";
  10. $_xml .= '<description>' . $_des . '</description>' . "\n";
  11. $_xml .= '</channel>' . "\n";
  12.  
  13. /********************************
  14. Number of records to return
  15. ********************************/
  16. $_count = 3;
  17. /********************************
  18. DB Variables
  19. ********************************/
  20. $_server = 'localhost';
  21. $_dbname = 'hehe';
  22. $_dbuser = 'hehe';
  23. $_dbpass = 'hehe';
  24. /********************************
  25. DB Connection
  26. ********************************/
  27. if ( !@mysql_connect( $_server, $_dbuser, $_dbpass ) ) {
  28. echo( 'Could not establish a connection to the database' );
  29. }
  30. /********************************
  31. Select DB
  32. ********************************/
  33. if ( !@mysql_select_db( $_dbname ) ) {
  34. echo( 'Could not establish a connection to the database' );
  35. }
  36. /********************************
  37. DB Query
  38. ********************************/
  39. $_qry = @mysql_query( "SELECT news_ID, news_header FROM news ORDER BY news_ID DESC LIMIT $_count" );
  40. /********************************
  41. Create the syndication
  42. ********************************/
  43. while ( $row = @mysql_fetch_array( $_qry ) )
  44. {
  45. $_xml .= '<item>' . "\n";
  46. $_xml .= '<title>';
  47. $_xml .= $row["news_header"];
  48. $_xml .= '</title>' . "\n";
  49. $_xml .= '<link>';
  50. $_xml .= 'http://www.cyclingnews.be/nieuws.php?news_ID='. $row["news_ID"];
  51. $_xml .= '</link>' . "\n";
  52. $_xml .= '</item>' . "\n";
  53. }
  54.  
  55. $_xml .= '</rdf:RDF>' . "\n";
  56. /***********************************
  57. Write XML to file
  58. ***********************************/
  59. $_file = 'news.rss';
  60. $_fp = fopen( $_file, 'w+' );
  61. $_fout = fwrite( $_fp, $_xml );
  62. fclose( $_fp );
  63. /***********************************
  64. Return File to user
  65. ***********************************/
  66. echo ("Cyclingfeed\n");
  67. echo ("--> news.rss");
  68. echo ("\n\n<a href='http://www.cyclingnews.be'>Keer terug</a>");
  69. ?>



Hoe moet dit dan???

Thx in advance!

Citaat:
Rensjuh edit:
[..code..]tags![/code]
Offline MothZone - 21/01/2006 17:43 (laatste wijziging 21/01/2006 17:43)
Avatar van MothZone PHP ver gevorderde
  1. <?php
  2.  
  3. //
  4. $_xml .= '<items license="Don\'t remove this paragraph, or your template will stop working. Amara Software owns the copyright to this template, which may not be sold or resold, in its original form or as part of another template, by anyone other than Amara Software. To check the full license restrictions, please refer to http://www.amarasoftware.com/ntlicense.html."/>' . "\n";
  5. $_xml .= '<?xml version="1.0" ?>' . "\n";
  6. //
  7.  
  8. ?>
Offline Ken - 21/01/2006 17:54
Avatar van Ken Nieuw lid http://www.cyclingnews.be/news.rss

klopt niet meer? 
Offline MothZone - 21/01/2006 17:55
Avatar van MothZone PHP ver gevorderde Jah, dan moet je die lijn ergens anders er tussen zetten, zal waarschijnlijk zijn omdat hij helemaal vanboven staat.

Probeer eens na <?xml ...?>
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.338s