Skip to content

Commit

Permalink
Fixed SEO data can not be fetch in detail error
Browse files Browse the repository at this point in the history
  • Loading branch information
linzongshu committed Aug 29, 2014
1 parent 852596d commit a48d9cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions usr/module/article/src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] : '',
));
}

Expand Down Expand Up @@ -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,
Expand All @@ -547,6 +549,7 @@ public static function getEntity($id)
'attachment' => array(),
'tag' => '',
'related' => array(),
'category_title' => $categories[$row->category]['title'],
);

// Get author
Expand Down Expand Up @@ -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(
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion usr/module/article/template/block/list-single.phtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
//Only show title
if (empty($elements)) {
if ($disorder == 1) {
if (isset($disorder) && $disorder == 1) {
$render = '<ol class="pi-list">';
} else {
$render = '<ol class="pi-order-list">';
Expand Down

0 comments on commit a48d9cb

Please sign in to comment.