';
}
}
// 2. 幼小衔接资源
$stmt = $db->prepare("
SELECT r.id, r.title
FROM resources r
JOIN subcategories s ON r.subcategory_id = s.id
JOIN categories c ON s.category_id = c.id
WHERE c.name = '幼小衔接'
ORDER BY r.id DESC
LIMIT 20
");
$stmt->execute();
$resources = $stmt->fetchAll();
if (!empty($resources)) {
echo '
';
}
// 3. 最新资源(跨所有分类)
$stmt = $db->query("
SELECT id, title
FROM resources
ORDER BY id DESC
LIMIT 30
");
$latestResources = $stmt->fetchAll();
if (!empty($latestResources)) {
echo '
';
}
// 4. 热门资源(可以根据下载量或访问量排序,这里用ID作为示例)
$stmt = $db->query("
SELECT id, title
FROM resources
ORDER BY id DESC
LIMIT 30 OFFSET 30
");
$popularResources = $stmt->fetchAll();
if (!empty($popularResources)) {
echo '