|
|
@ -134,12 +134,63 @@ |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<nav class="nd-pager" aria-label="上下篇"> |
|
|
<nav class="nd-pager" aria-label="上下篇"> |
|
|
<a class="nd-pager__item nd-pager__item--prev" href="/news-detail.html"> |
|
|
|
|
|
<span class="nd-pager__label">{hcTaglib:preContent /}</span> |
|
|
|
|
|
|
|
|
{php} |
|
|
|
|
|
// 与 HcTaglib::tagPreContent / tagNextContent 一致,只查相邻一篇 |
|
|
|
|
|
$id = (int)request()->param('id'); |
|
|
|
|
|
$cid = (int)request()->param('cid'); |
|
|
|
|
|
if ($cid <= 0) { |
|
|
|
|
|
$cid = (int)($current_cate['id'] ?? ($hc_content['category_id'] ?? 0)); |
|
|
|
|
|
} |
|
|
|
|
|
$sellerId = (int)($hc_content['seller_id'] ?? 1); |
|
|
|
|
|
$siteId = (int)($current_cate['website_id'] ?? 1); |
|
|
|
|
|
$lang = (string)($current_cate['lang'] ?? ($hc_content['lang'] ?? 'zh')); |
|
|
|
|
|
$preContent = \app\service\ContentService::getPreContent([ |
|
|
|
|
|
'id' => $id, |
|
|
|
|
|
'cid' => $cid, |
|
|
|
|
|
'seller_id' => $sellerId, |
|
|
|
|
|
'website_id' => $siteId, |
|
|
|
|
|
'lang' => $lang, |
|
|
|
|
|
]); |
|
|
|
|
|
$nextContent = \app\service\ContentService::getNextContent([ |
|
|
|
|
|
'id' => $id, |
|
|
|
|
|
'cid' => $cid, |
|
|
|
|
|
'seller_id' => $sellerId, |
|
|
|
|
|
'website_id' => $siteId, |
|
|
|
|
|
'lang' => $lang, |
|
|
|
|
|
]); |
|
|
|
|
|
$preId = 0; |
|
|
|
|
|
$preTitle = ''; |
|
|
|
|
|
$preCid = $cid; |
|
|
|
|
|
if (!empty($preContent)) { |
|
|
|
|
|
$preId = (int)$preContent['id']; |
|
|
|
|
|
$preTitle = $preContent['title']; |
|
|
|
|
|
} |
|
|
|
|
|
$nextId = 0; |
|
|
|
|
|
$nextTitle = ''; |
|
|
|
|
|
$nextCid = $cid; |
|
|
|
|
|
if (!empty($nextContent)) { |
|
|
|
|
|
$nextId = (int)$nextContent['id']; |
|
|
|
|
|
$nextTitle = $nextContent['title']; |
|
|
|
|
|
} |
|
|
|
|
|
{/php} |
|
|
|
|
|
{if condition="empty($preId)"} |
|
|
|
|
|
<a class="nd-pager__item nd-pager__item--prev" href="javascript:;"> |
|
|
|
|
|
<span class="nd-pager__label">上一篇:没有了</span> |
|
|
</a> |
|
|
</a> |
|
|
<a class="nd-pager__item nd-pager__item--next" href="/news-detail.html"> |
|
|
|
|
|
<span class="nd-pager__label">{hcTaglib:nextContent /}</span> |
|
|
|
|
|
|
|
|
{else /} |
|
|
|
|
|
<a class="nd-pager__item nd-pager__item--prev" href="{:hcUrl('Detail/index',['id'=>$preId,'cid'=>$preCid])}"> |
|
|
|
|
|
<span class="nd-pager__label">上一篇:{$preTitle}</span> |
|
|
</a> |
|
|
</a> |
|
|
|
|
|
{/if} |
|
|
|
|
|
{if condition="empty($nextId)"} |
|
|
|
|
|
<a class="nd-pager__item nd-pager__item--next" href="javascript:;"> |
|
|
|
|
|
<span class="nd-pager__label">下一篇:没有了</span> |
|
|
|
|
|
</a> |
|
|
|
|
|
{else /} |
|
|
|
|
|
<a class="nd-pager__item nd-pager__item--next" href="{:hcUrl('Detail/index',['id'=>$nextId,'cid'=>$nextCid])}"> |
|
|
|
|
|
<span class="nd-pager__label">下一篇:{$nextTitle}</span> |
|
|
|
|
|
</a> |
|
|
|
|
|
{/if} |
|
|
</nav> |
|
|
</nav> |
|
|
|
|
|
|
|
|
</article> |
|
|
</article> |
|
|
|