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'). " ". '>'; ?></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!