php - xml - filtro aleatorio y almacenar la orden
PHP: Recibo XML de 20 artículos, seleccioné 3 artículos al azar e imprimí xml en el mismo formato. El artículo elegido al azar debe cambiar aleatoriamente todos los días, no en cada actualización.
así, por ejemplo: art1, art2, art3, art ...... art20 debería mostrar: art4, art2, art 19 (aleatorio) pero debería con el mismo artículo durante todo el día - (10/12/12) y mañana debería ser art1, art20, art13 (otro conjunto aleatorio)
<?php
// Load our XML document
$doc = new DOMDocument();
$doc->load('feed.xml');
// Create an XPath object and register our namespaces so we can
// find the nodes that we want
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('p', 'http://purl.org/dc/elements/1.1/');
// Random generated xml should go here
// Write our updated XML back to a new file
$doc->save('feedout.xml');
?>
Dado que el almacenamiento del pedido de artículos necesita un servidor de almacenamiento de archivos, puedo rechazar eso. ¿Cómo puedo aleatorizar el artículo?
for ($i = 0; $i < $nodes->3; $i++) {
$node = $nodes->item($i);}
Gracias