- Home
- Categorie
- Coding e Sistemistica
- PHP
- [Array] Creazione per RSS
-
[Array] Creazione per RSS
Ciao a tutti.
Ho scaricato una classe che crea dei feed RSS. Il problema è estrarre i dati dal database (ok) ed inserirli in un'array del tipo:0=>array(
"title"=>"1 articolo", // This field is mandatory
"description"=>"blablabla", // This field is mandatory
"pubDate"=>"Wed, 02 Oct 2002 13:00:00 GMT",
"link"=>"http://www.immigrazione.biz/articolo.php?id=1234"
),
1=>array(
"title"=>"Exceptions of using XSL stylesheet", // This field is mandatory
"description"=>"When using XSL stylesheet, remember that Mozilla does not parse HTML tags. Though IE6 accepts HTML <b>tags</b> and parses them, Mozilla does not (and will never do). So using disable-output-escaping="yes" parameter in <xsl:text> and <xsl:value-of> would be effective in MSIE only.", // This field is mandatory
"pubDate"=>"Wed, 02 Oct 2002 13:00:00 GMT", // pubDate MUST BE the unix timestamp
"link"=>"http://bugzilla.mozilla.org/show_bug.cgi?id=98168"
)Qualche guru è disposto ad aiutarmi a creare l'array?
Vi ringrazio in anticipo.
-
puoi farne array di array
[php]
$query=mysql_query('SELECT * FROM ...');
$array_rss = array();
while($news=mysql_fetch_array($query)){
$array[] = array($news[titolo],$news[descr],...);
}[/php]
-
allora intanto ti ringrazio per la risposta ma ci sono degli errori causati sicuramente dalla mia non chiarezza. Ecco come dovrebbe essere il tutto:
// Query alla tabella $query="SELECT * FROM tab"; $risultato=mysql_query($query); // Estraggo dal database i dati che mi servono e li // inserisco in un array. $rss_array = array( "encoding"=>"UTF-8", "language"=>"en-us", "title"=>"Immigrazione.biz", // This field is mandatory "description"=>"Il portale di riferimento per gli immigrati in Italia", // This field is mandatory "link"=>"http://www.immigrazione.biz", // This field is mandatory "items"=>array( 0=>array( "title"=>"1 articolo", // This field is mandatory "description"=>"blablabla", // This field is mandatory "pubDate"=>"Wed, 02 Oct 2002 13:00:00 GMT", "link"=>"http://www.immigrazione.biz/articolo.php?id=1234" ), 1=>array( "title"=>"Exceptions of using XSL stylesheet", // This field is mandatory "description"=>"When using XSL stylesheet, remember that Mozilla does not parse HTML tags. Though IE6 accepts HTML <b>tags</b> and parses them, Mozilla does not (and will never do). So using disable-output-escaping="yes" parameter in <xsl:text> and <xsl:value-of> would be effective in MSIE only.", // This field is mandatory "pubDate"=>"Wed, 02 Oct 2002 13:00:00 GMT", // pubDate MUST BE the unix timestamp "link"=>"http://bugzilla.mozilla.org/show_bug.cgi?id=98168" ) ) );
-
nessuno mi puoi aiutare??