drduh44480 2016-07-25 08:01
浏览 50

PHP循环输出到同一页面上的多个HTML块

Ok, first of all I dont know the proper terminology for what i'm trying to accomplish here. But it seems straight forward, just not easy.

I'm working on a joomla mod_article_news override, using the original for loop. The problem is, i need to split the output in 2 different places, like:

<service_container>
    <services_carousel>
        <!-- PHP for loop starts here -->
            <service_block>
                Image and title
            <service_block>
        <!-- for loop ends here -->
    </services_carousel>

    <service_details>
        <details_list>
        <!-- I need the same For loop to output here at the same time -->
            <li>Intro text and Readmore button</li>
        </details_list>
    </service_details>
</service_container>

If you take a look, you can see I have the intro image and title in service_block, while the intro text and readmore button are in service_details.

The functionality here is basically intro image and title blocks, when user hovers over each block, the full-width container below will display the relevant intro text.

The original for loop looks like this:

<?php for ($i = 0, $n = count($list); $i < $n; $i ++) : ?>
    <?php $item = $list[$i]; ?>

If somebody can tell me the correct terminology for this, that would be great too! =)

Thanks in advance for any help and suggestions.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100