-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsitemap.php
More file actions
30 lines (24 loc) · 964 Bytes
/
Copy pathsitemap.php
File metadata and controls
30 lines (24 loc) · 964 Bytes
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
<?php
require_once 'config.php';
require_once 'template.php';
$all = $db->table('post')
->select('post.id as post_id, post.title, post.image, post.date_create, post.id_category, category.name as category_name, category.slug as category_slug, category.type as category_type')
->innerJoin('category', 'category.id', 'post.id_category')
->orderBy('post.date_create', 'desc')
->getAll();
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($all as $key => $v) {
if($v->category_type == 'movie'){
$url = "http://warez.dev/pelicula/{$v->category_slug}/{$v->post_id}-".warez::slug($v->title);
}else{
$url = "http://warez.dev/post/{$v->category_slug}/{$v->post_id}-".warez::slug($v->title);
}
echo "
<url>
<loc>{$url}</loc>
<lastmod>".date("Y-m-d")."T10:34:37+00:00</lastmod>
</url>
";
}
echo '</urlset>';