1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<?php
#***********************************
#***********************************
include('servconn.php');
connect();
//----------------------------------
$nl = "\r\n";
echo '<?xml version="1.0" encoding="utf-8"?>'.$nl;
echo '<root>'.$nl;
function pageArbo($parent, $level){
$nl = "\r\n";
$str = "";
$query = 'SELECT * FROM _pages WHERE idParent='.$parent.' ORDER BY ordre ASC ';
$result = mysql_query($query);
while($rPage = mysql_fetch_array($result)){
$str .= '<page
id="'.$rPage['id'].'"
parent="'.$rPage['idParent'].'"
active="'.$rPage['active'].'"
locked="'.$rPage['locked'].'"
ordre="'.$rPage['ordre'].'"
level="'.$level.'"
>'. $nl;
//----------------
//TITRE DE LA PAGE
//----------------
$str .= '<titres>'. $nl;
$queryLangues = 'SELECT * FROM _langues WHERE active = 1';
$resultLangues= mysql_query($queryLangues);
while($rLangues = mysql_fetch_array($resultLangues)){
$queryTitre = 'SELECT * FROM _pageslang WHERE idPage='.$rPage['id']. ' AND idLangue='.$rLangues['id'];
$resultTitre = mysql_query($queryTitre);
$rTitre = mysql_fetch_array($resultTitre);
$str .= '<titre lang="'.$rLangues['code'].'"><![CDATA['.stripslashes(utf8_encode($rTitre['titre'])).']]></titre>'.$nl;
}
$str .= '</titres>'. $nl;
//----------------
//METADONNEES DE LA PAGE
//----------------
$str .= '<metas>'. $nl;
$queryLangues = 'SELECT * FROM _langues WHERE active = 1';
$resultLangues= mysql_query($queryLangues);
while($rLangues = mysql_fetch_array($resultLangues)){
$queryMeta = 'SELECT * FROM _metalang WHERE idPage='.$rPage['id']. ' AND idLangue='.$rLangues['id'];
$resultMeta = mysql_query($queryMeta);
$rMeta = mysql_fetch_array($resultMeta);
$str .= '<meta lang="'.utf8_encode($rLangues['code']).'">'. $nl;
$str .= '<url>'.$rMeta['url'].'</url>'.$nl;
$str .= '<titre>'.stripslashes(utf8_encode($rMeta['titre'])).'</titre>'.$nl;
$str .= '<descriptif>'.stripslashes(utf8_encode($rMeta['descriptif'])).'</descriptif>'.$nl;
$str .= '<keywords>'.stripslashes(utf8_encode($rMeta['keywords'])).'</keywords>'.$nl;
$str .= '</meta>'. $nl;
}
$str .= '</metas>'. $nl;
//----------------
//SOUS RUBIQUES DE LA PAGE
//----------------
$str .= '<pages>'. $nl;
$str .= pageArbo($rPage['id'], $level+1);
$str .= '</pages>'. $nl;
$str .= '</page>'. $nl;
}
return $str;
}
echo pageArbo(0, 0);
echo '</root>'.$nl;
?> |
Partager