31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
<?php
|
|||
|
|
/**
|
||
|
|
* 首页卡片 · 往年的今天(v62 从 templates/home.php 拆出来的)。
|
||
|
|
*
|
||
|
|
* ⚠️ 只认「往年的今天」,**不退回同月**(v24 第 19 条)—— 见 home_memories() 的说明。
|
||
|
|
* @var array $memories ['rows' => [['kind','years_ago','title','href','starts_at'], ...]]
|
||
|
|
*/
|
||
|
|
$mmRows = (array)($memories['rows'] ?? []);
|
||
|
|
?>
|
||
|
|
<div class="hc-body">
|
||
|
|
<?php if (!$mmRows): ?>
|
||
|
|
<div class="empty">
|
||
|
|
<b>往年的这一天还没有记录</b>
|
||
|
|
日子还长,等有了第一次,明年这时候就会自己冒出来。
|
||
|
|
</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<ul class="dash-list">
|
||
|
|
<?php foreach ($mmRows as $mm): ?>
|
||
|
|
<li class="dash-row">
|
||
|
|
<span class="dash-dot" style="background: <?= $mm['kind'] === 'trip' ? '#3F7D5A' : '#7A4E8C' ?>;"></span>
|
||
|
|
<span class="dash-when"><?= (int)$mm['years_ago'] ?> 年前</span>
|
||
|
|
<a class="dash-what" href="<?= e((string)$mm['href']) ?>">
|
||
|
|
<?= $mm['kind'] === 'trip' ? '🧳 ' : '🎬 ' ?><?= e((string)$mm['title']) ?>
|
||
|
|
</a>
|
||
|
|
<span class="dash-tag"><?= e(substr((string)$mm['starts_at'], 0, 10)) ?></span>
|
||
|
|
</li>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|