Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ef38bd716 | ||
|
|
62c10b09bc | ||
|
|
935bc7f071 |
@@ -17,15 +17,21 @@ $e = View::escape(...);
|
||||
<?php if (!$group['articles']): ?><p class="empty-state">暂无已发布条目。</p><?php endif ?>
|
||||
<ul class="network-list">
|
||||
<?php foreach ($group['articles'] as $item): ?>
|
||||
<?php $card = $item['card']; $articlePath = '/articles/' . $item['slug']; ?>
|
||||
<?php
|
||||
// 优先跳卡片配置的网址;没有网址时,只有文章本身有内容才回退到文章页,否则不渲染链接。
|
||||
$card = $item['card'];
|
||||
$articlePath = '/articles/' . $item['slug'];
|
||||
$hasDetail = $item['body'] !== '' || $item['summary'] !== '';
|
||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? $articlePath : '');
|
||||
?>
|
||||
<li>
|
||||
<a href="<?= $e(($card['url'] ?? '') ?: $articlePath) ?>">
|
||||
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
||||
<?php endif ?>
|
||||
<span><?= $e($item['title']) ?></span>
|
||||
</a>
|
||||
<?php if ($standalone && !empty($card['url']) && ($item['body'] !== '' || $item['summary'] !== '')): ?>
|
||||
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
||||
<?php if ($standalone && !empty($card['url']) && $hasDetail): ?>
|
||||
<a class="network-detail" href="<?= $e($articlePath) ?>">查看详情</a>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
|
||||
@@ -17,9 +17,10 @@ $e = View::escape(...);
|
||||
<div class="catalog-grid">
|
||||
<?php foreach ($products as $product): ?>
|
||||
<?php
|
||||
// 目录卡片指向卡片自己配置的网址,文章页只在未设置网址时兜底。
|
||||
// 目录卡片指向卡片自己配置的网址;没有网址时,只有文章本身有内容才回退到文章页。
|
||||
$card = $product['card'];
|
||||
$target = ($card['url'] ?? '') ?: '/articles/' . $product['slug'];
|
||||
$hasDetail = $product['body'] !== '' || $product['summary'] !== '';
|
||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? '/articles/' . $product['slug'] : '');
|
||||
?>
|
||||
<article class="catalog-card">
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
@@ -27,16 +28,18 @@ $e = View::escape(...);
|
||||
<?php endif ?>
|
||||
<div class="catalog-content">
|
||||
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
||||
<h2><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a></h2>
|
||||
<h2><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h2>
|
||||
<?php if ($product['summary']): ?>
|
||||
<p><?= $e($product['summary']) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="rich"><?= Html::articleBody($product) ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($target !== '' || !empty($card['extra_url'])): ?>
|
||||
<div class="actions">
|
||||
<a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a>
|
||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||
<?php if (!empty($card['extra_url'])): ?><a href="<?= $e($card['extra_url']) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
|
||||
Reference in New Issue
Block a user