Skip to content

Commit 085b95c

Browse files
committed
fix url bug
1 parent ba48954 commit 085b95c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Action.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ public static function gen_all_url()
5858
foreach ($articles AS $article) {
5959
$type = $article['type'];
6060
$routeExists = (NULL != Typecho_Router::get($type));
61+
if(!is_null($routeExists)){
62+
$article['categories'] = $db->fetchAll($db->select()->from('table.metas')
63+
->join('table.relationships', 'table.relationships.mid = table.metas.mid')
64+
->where('table.relationships.cid = ?', $article['cid'])
65+
->where('table.metas.type = ?', 'category')
66+
->order('table.metas.order', Typecho_Db::SORT_ASC));
67+
$article['category'] = urlencode(current(Typecho_Common::arrayFlatten($article['categories'], 'slug')));
68+
$article['slug'] = urlencode($article['slug']);
69+
$article['date'] = new Typecho_Date($article['created']);
70+
$article['year'] = $article['date']->year;
71+
$article['month'] = $article['date']->month;
72+
$article['day'] = $article['date']->day;
73+
}
6174
$article['pathinfo'] = $routeExists ? Typecho_Router::url($type, $article) : '#';
6275
$urls[] = Typecho_Common::url($article['pathinfo'], $options->index);
6376
}

0 commit comments

Comments
 (0)