dougong2306 2019-07-09 11:13
浏览 24

Cakephp - 从数据库中计算某些寄存器记录并在屏幕上显示它们

Hello there to all PHP and Cakephp developers.

I have the next question about a certain problem that I am facing. I want to only display 4 registered favorite profiles at a time on an admin profile. The admin profile let's say is a patient profile and has the possibility to go through the website and add to his/her favorites, certain types of other entities such as doctors, clinics and dental clinics.

Currently, I am displaying every registered profile that has been added to favorites so the problem is that if a patient has added to his favorites 5 doctors, 5 doctors will appear.

Here is the piece of code that I have atm:

I have tried limiting that on the for loop which I have for displaying the profiles but wasn't really able to do much.

<div class="row zero_side_margin top_margin bottom_margin text-center side_paddings_md">
        <?php
        if(isset($favClinics) && !empty(($favClinics))) {
            for($i = 0; $i < count($favClinics); $i++) {
                $type = $favClinics[$i]['Clinic']['type'];
                if ($type === 'clinic'){
                    $container_id = '#FavoriteClin_' . $favClinics[$i]['RegistersClinic']['clinic_id'];
                    $id = $favClinics[$i]['RegistersClinic']['id'];
                    ?>
                    <div id="FavoriteClin_<?php echo $favClinics[$i]['RegistersClinic']['clinic_id']; ?>" > 
                        <div class="col-xs-<?php echo $bootstrapColWidth; ?> col-sm-<?php echo $bootstrapColWidth; ?> light_border bg_light no_side_paddings">
                            <div class="col-xs-12 col-sm-5">
                                <div class="text-left">
                                    <div class="top_padding_xs bottom_padding_xs">
                                        <div class="thumb_md_circle relative center-block">
                                            <img class="thumb_md_circle light_border_xl center-block img-responsive img-responsive" 
                                                 src="/files/Clinic/profile/<?php echo $favClinics[$i]['Clinic']['photo']; ?>"/>
                                        </div>
                                    </div>
                                </div> 
                            </div>
                            <div class="col-xs-12 col-sm-7">
                                <div class="no_side_paddings col-sm-9 text-left inline pull-left top_margin">
                                    <span class="text-info font_Conv_Roboto-Bold">
                                        <?php echo $favClinics[$i]['Clinic']['name']; ?>
                                    </span>
                                </div> 
                                 <div class="text-right pull-right inline top_margin">
                                    <a class="btn dropdown-toggle no_padding_top" data-toggle="dropdown" 
                                        onclick="delete_relation('<?php echo $container_id; ?>', 'clinic', <?php echo $id; ?>, <?php echo $user_id; ?>)">
                                         <i class="fa fa-2x fa-close text-muted_light"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php
                    $rowCenterCount++;
                    if ($rowCenterCount % $numOfCols == 0) {
                        echo '</div><div class="row zero_side_margin top_margin bottom_margin text-center side_paddings_md">';
                    }
                }
            } 
        }else{
            $rowCenterCount++;
            if ($rowCenterCount % $numOfCols == 0) {
                echo '</div><div class="row zero_side_margin top_margin bottom_margin text-center side_paddings_md">';
            }else{
                echo '</div>';
            }
        }
        ?>
    </div>
    <a class="top_margin_xs bottom_margin btn btn-lg bg-primary no_rounded_borders" onclick=""><?= __('See the rest of the doctors'). "&nbsp;&nbsp;&nbsp;&nbsp;". '>'; ?></a>    

I want to only display 4 doctors/clinics at a time but develop an extra button that would toggle and fade in the rest of the registered favorite doctors, hospitals, etc.

So if there would be 6 doctors, the 4 will always appear but when you would toggle the button "See the rest of the doctors", the rest will appear on the same container.

If you have any suggestion on how I can resolve this, it would be really grateful.

Thanks a lot!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测