<?php
// art_2.html 文章内容页·样式2：左侧正文 + 右侧信息卡（栏目/日期/阅读量/上下篇）
// 可用变量：$art 文章行(title/content/add_time/views)；$col 所属栏目(id/name，可为 null)
//          $prev $next 上一篇/下一篇(id/title 或 null)；$art['content'] 为管理员富文本，原样输出
$ar2       = isset($art) && is_array($art) ? $art : array();
$ar2_title = isset($ar2['title']) ? $ar2['title'] : '';
$ar2_cont  = isset($ar2['content']) ? $ar2['content'] : '';
$ar2_time  = isset($ar2['add_time']) ? (int)$ar2['add_time'] : 0;
$ar2_views = isset($ar2['views']) ? (int)$ar2['views'] : 0;
$ar2_col   = isset($col) && is_array($col) ? $col : null;
$ar2_prev  = isset($prev) && is_array($prev) ? $prev : null;
$ar2_next  = isset($next) && is_array($next) ? $next : null;
?>
<style>
.yk-art2{max-width:1200px;margin:0 auto;padding:24px 15px 44px;}
.yk-art2 .yk-art2-crumb{font-size:13px;color:#999;margin-bottom:18px;}
.yk-art2 .yk-art2-crumb a{color:#999;}
.yk-art2 .yk-art2-crumb a:hover{color:#1a5fb4;}
.yk-art2 .yk-art2-box{display:flex;gap:26px;align-items:flex-start;}
.yk-art2 .yk-art2-main{flex:1;min-width:0;background:#fff;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.05);padding:38px 44px;}
.yk-art2 .yk-art2-title{font-size:25px;line-height:1.45;margin:0 0 14px;}
.yk-art2 .yk-art2-meta{font-size:13px;color:#999;padding-bottom:16px;border-bottom:1px solid #eee;margin-bottom:24px;}
.yk-art2 .yk-art2-meta span{margin-right:18px;}
.yk-art2 .yk-art2-body{font-size:15px;line-height:1.95;color:#333;word-wrap:break-word;}
.yk-art2 .yk-art2-body img{max-width:100%;height:auto;}
.yk-art2 .yk-art2-body p{margin:0 0 1em;}
.yk-art2 .yk-art2-side{flex:none;width:280px;position:sticky;top:20px;}
.yk-art2 .yk-art2-card{background:#fff;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,.05);padding:22px 24px;margin-bottom:18px;}
.yk-art2 .yk-art2-ch{font-size:15px;font-weight:700;margin:0 0 14px;padding-left:10px;border-left:4px solid #1a5fb4;}
.yk-art2 .yk-art2-ir{display:flex;justify-content:space-between;font-size:13px;color:#777;padding:8px 0;border-bottom:1px dashed #f0f0f0;}
.yk-art2 .yk-art2-ir:last-child{border-bottom:none;}
.yk-art2 .yk-art2-ir b{font-weight:400;color:#333;}
.yk-art2 .yk-art2-ir a{color:#1a5fb4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px;display:inline-block;vertical-align:bottom;}
.yk-art2 .yk-art2-pn{font-size:13px;}
.yk-art2 .yk-art2-pn p{margin:0 0 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.yk-art2 .yk-art2-pn p:last-child{margin-bottom:0;}
.yk-art2 .yk-art2-pn span{color:#999;margin-right:6px;}
.yk-art2 .yk-art2-pn a{color:#333;}
.yk-art2 .yk-art2-pn a:hover{color:#1a5fb4;}
.yk-art2 .yk-art2-pn .yk-art2-none{color:#bbb;}
@media (max-width:1199px){
  .yk-art2 .yk-art2-side{width:240px;}
  .yk-art2 .yk-art2-main{padding:30px 32px;}
}
@media (max-width:767px){
  .yk-art2{padding:16px 14px 30px;}
  .yk-art2 .yk-art2-box{flex-direction:column;}
  .yk-art2 .yk-art2-side{width:100%;position:static;order:2;}
  .yk-art2 .yk-art2-main{padding:22px 18px;width:100%;}
  .yk-art2 .yk-art2-title{font-size:19px;}
  .yk-art2 .yk-art2-body{font-size:14px;line-height:1.85;}
}
</style>
<div class="yk-art2">
  <div class="yk-art2-crumb">
    <a href="<?php echo e(url_home()); ?>">首页</a>
    <?php if ($ar2_col && isset($ar2_col['id'])) { ?> &gt; <a href="<?php echo e(url_col($ar2_col['id'])); ?>"><?php echo e(isset($ar2_col['name']) ? $ar2_col['name'] : ''); ?></a><?php } ?>
    &gt; <span>正文</span>
  </div>
  <div class="yk-art2-box">
    <div class="yk-art2-main">
      <h1 class="yk-art2-title"><?php echo e($ar2_title); ?></h1>
      <div class="yk-art2-meta">
        <span>时间：<?php echo e(fdate($ar2_time, 'Y-m-d')); ?></span>
        <span>阅读：<?php echo $ar2_views; ?></span>
      </div>
      <div class="yk-art2-body"><?php echo $ar2_cont; /* 管理员富文本，原样输出 */ ?></div>
    </div>
    <aside class="yk-art2-side">
      <div class="yk-art2-card">
        <h3 class="yk-art2-ch">文章信息</h3>
        <div class="yk-art2-ir"><span>所属栏目</span><?php if ($ar2_col && isset($ar2_col['id'])) { ?><a href="<?php echo e(url_col($ar2_col['id'])); ?>"><?php echo e(isset($ar2_col['name']) ? $ar2_col['name'] : ''); ?></a><?php } else { ?><b>未分类</b><?php } ?></div>
        <div class="yk-art2-ir"><span>发布日期</span><b><?php echo e(fdate($ar2_time, 'Y-m-d')); ?></b></div>
        <div class="yk-art2-ir"><span>阅读量</span><b><?php echo $ar2_views; ?></b></div>
      </div>
      <div class="yk-art2-card">
        <h3 class="yk-art2-ch">上下篇</h3>
        <div class="yk-art2-pn">
          <p><span>上一篇</span><?php if ($ar2_prev) { ?><a href="<?php echo e(url_art($ar2_prev['id'])); ?>"><?php echo e($ar2_prev['title']); ?></a><?php } else { ?><b class="yk-art2-none">没有了</b><?php } ?></p>
          <p><span>下一篇</span><?php if ($ar2_next) { ?><a href="<?php echo e(url_art($ar2_next['id'])); ?>"><?php echo e($ar2_next['title']); ?></a><?php } else { ?><b class="yk-art2-none">没有了</b><?php } ?></p>
        </div>
      </div>
    </aside>
  </div>
</div>
