git-svn-id: https://msi/svn/firstRepo/WebClient/trunk@15 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2014-12-10 15:06:13 +00:00
parent 876ee18579
commit f57f55e2a9
58 changed files with 873 additions and 487 deletions
+63
View File
@@ -0,0 +1,63 @@
<?php
/**
* XML Sitemap PHP Script
* For more info, see: http://yoast.com/xml-sitemap-php-script/
* Copyright (C), 2011 - 2012 - Joost de Valk, [email protected]
*/
// inclusione del file contenente la classe
require_once "./Service/MySqlClass.php";
require_once "./Service/utility.php";
// Get the keys so we can check quickly
// Sent the correct header so browsers display properly, with or without XSL.
header( 'Content-Type: application/xml' );
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
$url = "http://app.gruppolapastamadre.it/";
$blog_timezone = 'UTC';
$timezone_offset = '+01:00';
$W3C_datetime_format_php = 'Y-m-d\Th:i:s'; // See http://www.w3.org/TR/NOTE-datetime
function dinamicSite() {
global $url, $blog_timezone, $timezone_offset, $W3C_datetime_format_php;
$mysqlconnetion = new MysqlClass;
//$mysqlconneti on->connetti();
$retObj = $mysqlconnetion->queryToObject("select ID as category_id, NAME as name from categorie order by name");
foreach ($retObj as $key => $value)
{
$catStr = "#category/". $value["name"] ."/" . $value["category_id"];
$lastModified = $mysqlconnetion->queryToObject("select MAX(Data_creazione) as lastModified from ricette where ID_CATEGORIA = ". $value["category_id"]);
$date = DateTime::createFromFormat('Y-m-d H:i:s', $lastModified[0]["lastModified"], new DateTimeZone("Europe/Rome"));
$lastDate = date_format($date, $W3C_datetime_format_php) . $timezone_offset;
?>
<url>
<loc><?php echo $url . $catStr; ?></loc>
<lastmod><?php echo $lastDate; ?></lastmod>
</url><?php
$query = "select ID as ricetta_id, titolo from ricette where ID_CATEGORIA = " . $value["category_id"] . " order by titolo, autore";
$ricItems = $mysqlconnetion->queryToObject($query);
foreach ($ricItems as $keyRic => $valueRic)
{
$itemStr= "#ricetta/" . $valueRic["ricetta_id"];
?>
<url>
<loc><?php echo $url . $itemStr; ?></loc>
</url><?php
}
}
$mysqlconnetion->disconnetti();
}
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><?php
dinamicSite();
?>
</urlset>