/* 列表数据准备:与页面第一页一致,只标已发布且有链接的条目 */ $__abs = function ($p) use ($bd) { $p = trim((string)$p); if ($p === '') { return ''; } if (preg_match('#^https?://#i', $p)) { return $p; } if (str_starts_with($p, '//')) { return (str_starts_with((string)$bd['httpurl'], 'https') ? 'https:' : 'http:') . $p; } return rtrim((string)$bd['httpurl'], '/') . '/' . ltrim($p, '/'); }; $__rows = \app\index\model\cms\Content::contentList(['scode' => $sort['scode'], 'num' => 10]); $__items = []; foreach (($__rows['data'] ?? []) as $__r) { $__u = $__abs($__r['link'] ?? ''); if ($__u === '') { continue; } $__items[] = [ 'name' => html_entity_decode((string)$__r['title'], ENT_QUOTES, 'UTF-8'), 'url' => $__u, ]; } $__icount = count($__items); {/php}