show.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. {include file="header" /}
  2. <link rel="stylesheet" href="/assets/xtu/show-news.css?v=20260429-1715">
  3. {php}
  4. $articleTitle = trim((string)($title ?? ''));
  5. $articleTitle = $articleTitle !== '' ? $articleTitle : trim((string)($category['catname'] ?? '新闻详情'));
  6. $articleDesc = trim((string)($description ?? ''));
  7. if ($articleDesc === '' && !empty($content)) {
  8. $articleDesc = mb_substr(trim(strip_tags((string)$content)), 0, 140, 'utf-8');
  9. }
  10. $articleHero = '';
  11. foreach (['thumb3', 'thumb2', 'thumb1', 'thumb'] as $imageField) {
  12. if (!empty($$imageField)) {
  13. $articleHero = $$imageField;
  14. break;
  15. }
  16. }
  17. $articlePublish = !empty($publish_time) ? date('Y-m-d', (int)$publish_time) : '';
  18. $articleUpdate = !empty($update_time) ? date('Y-m-d', (int)$update_time) : '';
  19. $articleTags = [];
  20. if (!empty($tags)) {
  21. $articleTags = array_values(array_filter(array_map('trim', explode(',', (string)$tags))));
  22. }
  23. {/php}
  24. <main class="show-news-page">
  25. <section class="show-news-hero">
  26. <div class="content-1200-wrap show-news-hero-shell is-no-hero">
  27. <div class="show-news-hero-copy">
  28. <div class="show-news-breadcrumb">
  29. <a href="{:cms_lang_url(addon_url('cms/index/index'))}">{:cms_t('home','首页')}</a>
  30. <span>/</span>
  31. <a href="{:getCategory($catid,'url')}">{$category.catname|default=''}</a>
  32. </div>
  33. <h1>{$articleTitle}</h1>
  34. <div class="show-news-meta">
  35. {if $articlePublish !== ''}<span>{$articlePublish}</span>{/if}
  36. {if !empty($hits)}<span>{:cms_t('views','浏览')} {$hits}</span>{/if}
  37. {if $articleUpdate !== '' && $articleUpdate !== $articlePublish}<span>{:cms_t('updated_at','更新于')} {$articleUpdate}</span>{/if}
  38. </div>
  39. </div>
  40. </div>
  41. </section>
  42. <section class="show-news-main">
  43. <div class="content-1200-wrap show-news-main-shell">
  44. <article class="show-news-article">
  45. <div class="show-news-content">
  46. {if $is_pay || $is_part_content_pay == 1}
  47. {if !empty($content)}
  48. {$content|raw}
  49. {elseif !empty($description) /}
  50. <p>{$description}</p>
  51. {else /}
  52. <p>{:cms_t('content_empty','暂无内容')}</p>
  53. {/if}
  54. {/if}
  55. {if !$is_pay && $readpoint > 0}
  56. <div class="show-news-paywall">
  57. <p>{:cms_t('paid_read_tip_prefix','阅读此内容需要支付')} <strong>{$readpoint} {if $paytype==1}{:cms_t('currency_yuan','元')}{else /}{:cms_t('points','积分')}{/if}</strong></p>
  58. <div class="show-news-paywall-actions">
  59. {if $paytype==1}
  60. <a href="{:addon_url('cms/order/submit',['catid'=>$catid,'id'=>$id,'pay_type'=>'wechat'])}" class="show-news-pay-btn">微信支付</a>
  61. <a href="{:addon_url('cms/order/submit',['catid'=>$catid,'id'=>$id,'pay_type'=>'alipay'])}" class="show-news-pay-btn is-light">支付宝支付</a>
  62. {/if}
  63. <a href="{:addon_url('cms/order/submit',['catid'=>$catid,'id'=>$id,'pay_type'=>'balance'])}" class="show-news-pay-btn is-light">余额支付</a>
  64. </div>
  65. </div>
  66. {/if}
  67. {if !empty($pages)}
  68. <div class="show-news-pages">{$pages|raw}</div>
  69. {/if}
  70. </div>
  71. {if !empty($articleTags)}
  72. <div class="show-news-tags-bar">
  73. <div class="show-news-tag-list">
  74. {volist name="articleTags" id="tag"}
  75. <a href="{:addon_url('cms/tags/index',[':tag'=>$tag])}">{$tag}</a>
  76. {/volist}
  77. </div>
  78. </div>
  79. {/if}
  80. <div class="show-news-bottom-nav">
  81. {yzn module="cms" action="pre" catid="$catid" id="$id" cache="3600" return="prevData"}
  82. {if !empty($prevData) && !empty($prevData.url)}
  83. <a class="show-news-bottom-nav-item" href="{$prevData.url}">
  84. <small>{:cms_t('prev_article','上一篇')}</small>
  85. <strong>{$prevData.title|default='暂无上一篇'}</strong>
  86. </a>
  87. {else /}
  88. <div class="show-news-bottom-nav-item is-disabled">
  89. <small>{:cms_t('prev_article','上一篇')}</small>
  90. <strong>{:cms_t('no_prev_article','暂无上一篇')}</strong>
  91. </div>
  92. {/if}
  93. {/yzn}
  94. {yzn module="cms" action="next" catid="$catid" id="$id" cache="3600" return="nextData"}
  95. {if !empty($nextData) && !empty($nextData.url)}
  96. <a class="show-news-bottom-nav-item" href="{$nextData.url}">
  97. <small>{:cms_t('next_article','下一篇')}</small>
  98. <strong>{$nextData.title|default='暂无下一篇'}</strong>
  99. </a>
  100. {else /}
  101. <div class="show-news-bottom-nav-item is-disabled">
  102. <small>{:cms_t('next_article','下一篇')}</small>
  103. <strong>{:cms_t('no_next_article','暂无下一篇')}</strong>
  104. </div>
  105. {/if}
  106. {/yzn}
  107. </div>
  108. </article>
  109. </div>
  110. </section>
  111. {php}
  112. $relatedWhere = "`catid` = " . (int)$catid . " AND `id` <> " . (int)$id . " AND `status` = 1";
  113. {/php}
  114. {yzn module="cms" action="lists" catid="$catid" where="$relatedWhere" order="publish_time DESC,id DESC" num="3" return="relatedNews" moreinfo="1"}
  115. {if !empty($relatedNews)}
  116. <section class="show-news-related-section">
  117. <div class="content-1200-wrap">
  118. <div class="show-news-related-head">
  119. <h2>{:cms_t('related_articles','相关推荐')}</h2>
  120. </div>
  121. <div class="show-news-related-grid">
  122. {volist name="relatedNews" id="related"}
  123. <a class="show-news-related-card" href="{$related.url}">
  124. <div class="show-news-related-card-thumb">
  125. <img src="{if !empty($related.thumb)}{$related.thumb}{elseif !empty($related.thumb1) /}{$related.thumb1}{else /}/uploads/20260409/15d257a4faf1bc9aadd0095112b6b7f7.png{/if}" alt="{$related.title}">
  126. </div>
  127. <div class="show-news-related-card-copy">
  128. <span>{$related.publish_time|date='Y-m-d'}</span>
  129. <h3>{$related.title}</h3>
  130. </div>
  131. </a>
  132. {/volist}
  133. </div>
  134. </div>
  135. </section>
  136. {/if}
  137. {/yzn}
  138. {include file="footer-links" /}
  139. </main>
  140. {include file="footer" /}