From a48d9cb3465c660458359ff87ac55512329b39e5 Mon Sep 17 00:00:00 2001 From: lin40553024 Date: Fri, 29 Aug 2014 15:25:26 +0800 Subject: [PATCH] Fixed SEO data can not be fetch in detail error --- usr/module/article/src/Entity.php | 9 ++++++--- usr/module/article/template/block/list-single.phtml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usr/module/article/src/Entity.php b/usr/module/article/src/Entity.php index 64eb9704bd..83af97c125 100755 --- a/usr/module/article/src/Entity.php +++ b/usr/module/article/src/Entity.php @@ -461,7 +461,7 @@ public static function getArticlePage( 'module' => $module, 'time' => date('Ymd', $row['time_publish']), 'id' => $row['id'], - 'slug' => $extended[$row['id']]['slug'], + 'slug' => isset($extended[$row['id']]) ? $extended[$row['id']]['slug'] : '', )); } @@ -531,6 +531,8 @@ public static function getEntity($id) $subtitle = Pi::service('markup')->render($row->subtitle, 'html'); } $content = Compiled::getContent($row->id, 'html'); + + $categories = Pi::api('api', $module)->getCategoryList(); $result = array( 'title' => $subject, @@ -547,6 +549,7 @@ public static function getEntity($id) 'attachment' => array(), 'tag' => '', 'related' => array(), + 'category_title' => $categories[$row->category]['title'], ); // Get author @@ -634,7 +637,7 @@ public static function getEntity($id) // Getting seo $modelExtended = Pi::model('extended', $module); - $rowExtended = $modelExtended->find($row->id); + $rowExtended = $modelExtended->find($row->id, 'article'); if ($rowExtended) { $result['slug'] = $rowExtended->slug; $result['seo'] = array( @@ -646,7 +649,7 @@ public static function getEntity($id) // Getting stats data $modelStatis = Pi::model('stats', $module); - $rowStatis = $modelStatis->find($row->id); + $rowStatis = $modelStatis->find($row->id, 'article'); if ($rowStatis) { $result['visits'] = $rowStatis->visits; } diff --git a/usr/module/article/template/block/list-single.phtml b/usr/module/article/template/block/list-single.phtml index 48116d2092..3b9de29456 100644 --- a/usr/module/article/template/block/list-single.phtml +++ b/usr/module/article/template/block/list-single.phtml @@ -1,7 +1,7 @@ '; } else { $render = '
    ';