我爱模板

帝国列表调用其他栏目包含这个信息id的调用

✦AI 智能解读AI 生成

这套帝国CMS教程适合用帝国CMS做漫画或小说站的开发者,讲解在列表页调用其他栏目中与当前信息id关联的数据。内容以SQL查询和PHP循环输出为主,涉及章节标题、链接和缩略图调用,需要具备一定二次开发能力才能套用。

内容由 AI 依据商品页信息生成,请以商品页描述为准

帝国列表调用其他栏目包含这个信息id的调用

$chapter_sql = "select * from {$dbtbpre}ecms_zhangjie where  bookid='".$r[id]."' order by newstime desc limit 6";

$chapter_result = $empire->query($chapter_sql);

$chapter_html = '';

while($chapter_r = $empire->fetch($chapter_result)){

    $chapter_titleurl = sys_ReturnBqTitleLink($chapter_r);

    $chapter_html .= '

    <div class="chapter-item">

<a href="'.$chapter_titleurl.'">

        <img src="'.$chapter_r[titlepic].'" alt="'.$chapter_r[title].'" class="chapter-img"></a>

        <a href="'.$chapter_titleurl.'" class="chapter-link">'.$chapter_r[title].'</a>

    </div>

    ';

}




$listtemp = '

<div class="container1">

    <!-- 左侧漫画介绍 -->

        <div class="comic-info">

<a href="[!--titleurl--]">

            <img src="[!--titlepic--]" alt="[!--title--]" class="comic-cover">

</a>

        </div>




    <!-- 右侧章节列表(无背景查看更多按钮) -->

    <div class="chapter-list">

        <div class="chapter-header">

            <h2>最新章节</h2>

            <!-- 保留button标签,保持点击功能,样式改为无背景文字链接 -->

            <a href="[!--titleurl--]">

                <button class="more-btn">查看更多</button>

            </a>

        </div>

        

        <div class="chapter-grid">

            '.$chapter_html.'

        </div>

    </div>

</div>

';

灵动标签方式:

[e:loop={'news',1,18,0,'','newstime DESC'}]

<div class="fullwidth-wrapper">

    <div class="mod6-dark">

        <div class="mod6-19">

            <div class="mod6-left">

                <div class="rec-title">重磅推荐</div>

                <div class="top1-cover">

                    <img src="<?=$bqr['titlepic']?>" alt="top1">

                    <div class="top1-info">

                        <span class="top1-tag">TOP1</span>

                        <span class="top1-name"><?=$bqr['title']?></span>

                        <span class="top1-date"><?=date('Y-m-d',$bqr[newstime])?></span>

                    </div>

                </div>

                <div class="desc"><?=$bqr['smalltext']?></div>

            </div>

            <div class="mod6-right">

                <?php

                // 核心查询:保留你的原始逻辑

                $cur_bookid = $bqr['id'];

                $chapter_sql = "select * from {$dbtbpre}ecms_zhangjie where bookid='".$cur_bookid."' order by newstime desc limit 6";

                $chapter_result = $empire->query($chapter_sql);

                while($chapter_r = $empire->fetch($chapter_result)){

                    $chapter_titleurl = sys_ReturnBqTitleLink($chapter_r);

                    $chapter_date = date('m-d', $chapter_r['newstime']);

                ?>







<div class="episode-card"><img src="<?=$chapter_r['titlepic']?>"><div class="episode-text"><span class="episode-title">第<?=$chapter_r['ftitle']?>话</span><span class="episode-date"><?=$chapter_date?></span></div></div>

                <?php } ?>

            </div>

        </div>

    </div>

</div>

[/e:loop]

给TA打赏
共{{data.count}}人
人已打赏
站长学院建站经验

新手做网站选择自适应还是分开做电脑端+手机端好呢?

2025-11-18 19:18:18

站长学院

帝国cms当点击量超过一万的时候换成万为单位同时保留两位数的方法

2026-3-2 21:12:23

【腾讯云】11.11云上盛惠!云服务器首年1.8折起,买1年送3个月!
11.11云上盛惠!海量产品·轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。
查看更多相关信息>>
❯
个人中心
购物车
优惠劵
搜索