<?php
include("common.ini.php");
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
class GalleryXml
{
function GalleryXml($catalog)
{
$this->catalog = $catalog;
/* $items = $this->catalog->items->model->gets("WHERE categ_id=0");
foreach($items as $item)
{
?><item title="<?php echo $item["title"]?>" file="rwx/<?php echo $item['file']?>" file_thumb="rwx/<?php echo $item["file_thumb"]?>" ><![CDATA[<?php echo $item['comment']?>]]></item><?php
}
*/
$this->category_parse_($this->catalog->categs_gets(),"\t");
echo "\n";
}
function category_parse_($_categories,$_nbsp="")
{
foreach($_categories as $category)
{
?>
<?php echo $_nbsp?><category id="<?php echo $category["id"]?>">
<title><![CDATA[<?php echo $category["title"]?>]]></title>
<file_thumb>rwx/<?php echo $category["img"]?></file_thumb>
<items>
<?php
$items = $this->catalog->items->model->gets("WHERE categ_id=".$category["id"]." ORDER BY rank DESC,title, id DESC");
foreach($items as $item)
{
?>
<?php echo $_nbsp?><item id="<?php echo $item["id"]?>">
<title><![CDATA[<?php echo $item["title"]?>]]></title>
<file>rwx/<?php echo $item['file']?></file>
<file_thumb>rwx/<?php echo $item["file_thumb"]?></file_thumb>
<comment><![CDATA[<?php echo $item['comment']?>]]></comment>
</item>
<?php } ?>
</items>
<?php if(count($category['childs']))
$this->category_parse_($category['childs'],$_nbsp."\t");
?>
<?php echo $_nbsp?></category><?php
}
}
}
?>
<catalog>
<config
file_thumb_size="<?php echo $config['file_thumb_size']?>"
/>
<categories>
<?php $xml = new GalleryXml($catalog,"\t");?>
</categories>
</catalog>