robots.txt, sitemap и начата работа по созданию отдельной страницы для каждой точки
This commit is contained in:
parent
75b541772b
commit
742bd12d1b
|
|
@ -14,7 +14,7 @@ function __autoload($className)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$loaded){
|
if (!$loaded){
|
||||||
App::error404();
|
App::error404('Class '.$className.' was not loaded!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Coord
|
||||||
|
{
|
||||||
|
static function dergeeToMinute($input)
|
||||||
|
{
|
||||||
|
if ($input < 0)
|
||||||
|
$input *= -1;
|
||||||
|
|
||||||
|
$degree = floor($input);
|
||||||
|
$minute = 60 * ($input - $degree);
|
||||||
|
|
||||||
|
return $degree.'°'.$minute.'\'';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -49,8 +49,9 @@ class IndexController extends Controller
|
||||||
|
|
||||||
$res = App::$DB->query("SELECT COUNT(`id`) pointsCount FROM `points`")->fetch(PDO::FETCH_ASSOC);
|
$res = App::$DB->query("SELECT COUNT(`id`) pointsCount FROM `points`")->fetch(PDO::FETCH_ASSOC);
|
||||||
App::setConfig('title', $res['pointsCount'].' или даже больше поводов не сидеть дома');
|
App::setConfig('title', $res['pointsCount'].' или даже больше поводов не сидеть дома');
|
||||||
|
self::addVar('pointsCount', $res['pointsCount']);
|
||||||
|
|
||||||
if($_GET['point'] && is_numeric($_GET['point']))
|
if(isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point']))
|
||||||
{
|
{
|
||||||
$id = (int) $_GET['point'];
|
$id = (int) $_GET['point'];
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ class IndexController extends Controller
|
||||||
$point->descriptionHtml .= ' #wikipoints';
|
$point->descriptionHtml .= ' #wikipoints';
|
||||||
|
|
||||||
$og['title'] = $point->name . ' - wikipoints.ru';
|
$og['title'] = $point->name . ' - wikipoints.ru';
|
||||||
$og['description'] = $point->descriptionHtml;
|
$og['description'] = 'http://wikipoints.ru/?point='.$id.' '.$point->descriptionHtml;
|
||||||
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
|
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
|
||||||
$og['type'] = 'article';
|
$og['type'] = 'article';
|
||||||
$og['url'] = 'http://wikipoints.ru/?point='.$id;
|
$og['url'] = 'http://wikipoints.ru/?point='.$id;
|
||||||
|
|
@ -71,7 +72,7 @@ class IndexController extends Controller
|
||||||
else if($_GET['point'] && strtolower($_GET['point']) == 'random')
|
else if($_GET['point'] && strtolower($_GET['point']) == 'random')
|
||||||
{
|
{
|
||||||
$og['title'] = 'Случайная точка на wikipoints.ru';
|
$og['title'] = 'Случайная точка на wikipoints.ru';
|
||||||
$og['description'] = 'Точка на карте, выбранная случайным образом. Лучший способ узнать что-то новое!';
|
$og['description'] = 'Загляните сюда: http://vk.com/wikipoints Случайная точка на карте - лучший способ узнать что-то новое!';
|
||||||
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
|
$og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома';
|
||||||
$og['type'] = 'article';
|
$og['type'] = 'article';
|
||||||
$og['url'] = 'http://wikipoints.ru/?point=random';
|
$og['url'] = 'http://wikipoints.ru/?point=random';
|
||||||
|
|
@ -131,4 +132,24 @@ class IndexController extends Controller
|
||||||
App::redirect('/');
|
App::redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function actionSitemap()
|
||||||
|
{
|
||||||
|
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>');
|
||||||
|
|
||||||
|
$points = new Point();
|
||||||
|
$points = $points->getAll('', 'ID DESC');
|
||||||
|
|
||||||
|
foreach ($points as $point)
|
||||||
|
{
|
||||||
|
$url = $xml->addChild('url');
|
||||||
|
$url->addChild('loc', 'http://wikipoints.ru/page/point/id/' . $point['id']);
|
||||||
|
$url->addChild('lastmod', date("Y-m-d", $point['date']));
|
||||||
|
$url->addChild('changefreq', "weekly");
|
||||||
|
$url->addChild('priority', "0.8");
|
||||||
|
}
|
||||||
|
|
||||||
|
Header('Content-type: text/xml');
|
||||||
|
print($xml->asXML());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,44 @@ class PageController extends Controller
|
||||||
'points' => $result,
|
'points' => $result,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function actionPoint()
|
||||||
|
{
|
||||||
|
self::$layout = 'layoutPage.php';
|
||||||
|
|
||||||
|
$id = (int) App::getParam('id');
|
||||||
|
if ($id)
|
||||||
|
{
|
||||||
|
self::addScript('/js/jquery-2.1.0.min.js');
|
||||||
|
self::addScript('/js/jquery-ui-1.10.4.custom.min.js');
|
||||||
|
self::addScript('/js/bootstrap.min.js');
|
||||||
|
|
||||||
|
self::addScript('/js/app.js?ver=' . App::getConfig('version'));
|
||||||
|
|
||||||
|
self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
|
||||||
|
self::addStyle('/css/bootstrap.min.css');
|
||||||
|
self::addStyle('/css/bootstrap-theme.min.css');
|
||||||
|
|
||||||
|
$point = new Point();
|
||||||
|
$point = $point->getByPK($id);
|
||||||
|
$point->descriptionHtml = nl2br($point->description);
|
||||||
|
$point->name = htmlspecialchars($point->name);
|
||||||
|
|
||||||
|
$categories = new Category();
|
||||||
|
$categories = $categories->getAll();
|
||||||
|
|
||||||
|
$point->categoryIcon = $categories[$point->categoryId]['icon'];
|
||||||
|
$point->categoryName = $categories[$point->categoryId]['name'];
|
||||||
|
|
||||||
|
self::render('point.php', array(
|
||||||
|
'point' => $point,
|
||||||
|
'categories' => $categories,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
App::error404();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<br/><br/>
|
||||||
|
<h3><?= $point->name ?></h3>
|
||||||
|
|
||||||
|
Координаты:
|
||||||
|
<nobr>
|
||||||
|
<?= $point->lat > 0 ? 'N' : 'S' ?><?= $point->lat > 0 ? $point->lat : (-1 * $point->lat) ?>°
|
||||||
|
<?= $point->lng > 0 ? 'E' : 'W' ?><?= $point->lng > 0 ? $point->lng : (-1 * $point->lng) ?>°
|
||||||
|
</nobr>
|
||||||
|
/
|
||||||
|
<nobr>
|
||||||
|
<?= $point->lat > 0 ? 'N' : 'S' ?><?= Coord::dergeeToMinute($point->lat) ?>
|
||||||
|
<?= $point->lng > 0 ? 'E' : 'W' ?><?= Coord::dergeeToMinute($point->lng) ?>
|
||||||
|
</nobr>
|
||||||
|
/
|
||||||
|
<a href="/?point=<?= $point->id ?>">На карте</a>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
<?= $point->descriptionHtml ?>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div style="text-align: center">
|
||||||
|
<img src="<?= $point->img ?>" style="max-width: 800px;">
|
||||||
|
</div>
|
||||||
|
|
@ -87,6 +87,7 @@ function init(lat, lng) {
|
||||||
if (!myMap._popup && $('#boxRoute').css('display') == 'none')
|
if (!myMap._popup && $('#boxRoute').css('display') == 'none')
|
||||||
{
|
{
|
||||||
history.pushState({}, document.title, "/?lat=" + myMap.getCenter().lat + "&lng=" + myMap.getCenter().lng + "&zoom=" + myMap.getZoom());
|
history.pushState({}, document.title, "/?lat=" + myMap.getCenter().lat + "&lng=" + myMap.getCenter().lng + "&zoom=" + myMap.getZoom());
|
||||||
|
document.title = pointsCount+' или даже больше поводов не сидеть дома';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -189,7 +190,10 @@ function showInfo(id)
|
||||||
description = description + data.descriptionHtml;
|
description = description + data.descriptionHtml;
|
||||||
|
|
||||||
if (data.source.length > 11)
|
if (data.source.length > 11)
|
||||||
|
{
|
||||||
|
//description = description + ' <a href="/page/point/id/' + id + '" target="blank">Подробнее...</a>';
|
||||||
description = description + ' <a href="' + data.source + '" target="blank">Подробнее...</a>';
|
description = description + ' <a href="' + data.source + '" target="blank">Подробнее...</a>';
|
||||||
|
}
|
||||||
|
|
||||||
description = description + '</div><div class="clear"></div>';
|
description = description + '</div><div class="clear"></div>';
|
||||||
|
|
||||||
|
|
@ -201,6 +205,7 @@ function showInfo(id)
|
||||||
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
||||||
|
|
||||||
history.pushState({}, document.title, "/?point=" + id);
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
|
document.title = data.name;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -209,6 +214,7 @@ function showInfo(id)
|
||||||
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom());
|
||||||
|
|
||||||
history.pushState({}, document.title, "/?point=" + id);
|
history.pushState({}, document.title, "/?point=" + id);
|
||||||
|
document.title = points[id].options.title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,8 +283,6 @@ function showMeOnTheMap()
|
||||||
points.im.setLatLng(coords).addTo(myMap);
|
points.im.setLatLng(coords).addTo(myMap);
|
||||||
myMap.setView(coords, 15);
|
myMap.setView(coords, 15);
|
||||||
});
|
});
|
||||||
|
|
||||||
//myMap.setCenter(points.im.geometry.getCoordinates());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
User-agent: *
|
||||||
|
Allow: /
|
||||||
|
Sitemap: http://wikipoints.ru/index/sitemap
|
||||||
Loading…
Reference in New Issue