<?php
if($categories){
  foreach ($categories as $cid => $category) {  ?>
    <?php if($cid == 3): ?>
        <div class="col col-box">
            <div class="subjects-wraper">
                <div class="row">
                    <div class="col-3 col-md-2 d-flex d-md-block justify-content-center">
                        <img class="logo" src='<?php echo $category['crb_cat_photo']; ?>'>
                    </div>
                    <div class="col-9 col-md-10">
                        <h3><?php echo $category['title']; ?></h3>
                          <?php foreach ($category["sub_crb_cat"] as $scid => $subcat) {  ?>
                            <?php if($scid == 2): ?>
                                <ul>
                                    <li>
                                      <a href="<?php echo get_permalink($pageID); ?>/?cid=<?php echo $cid ?>&scid=<?php echo $scid ?>&data=<?php echo $subcat['api_title'] ?>&parent=<?php echo $category['title'] ?>&son=<?php echo $subcat['title'] ?>&list"><?php echo $subcat['title'] ?></a>
                                    </li>
                                </ul>
                            <?php else: ?>
                                <ul>
                                    <li>
                                      <a href="<?php echo get_permalink($pageID); ?>/?cid=<?php echo $cid ?>&scid=<?php echo $scid ?>&data=<?php echo $subcat['api_title'] ?>&parent=<?php echo $category['title'] ?>&son=<?php echo $subcat['title'] ?>&list"><?php echo $subcat['title'] ?></a>
                                    </li>
                                </ul>
                            <?php endif; ?>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    <?php else: ?>
        <div class="col col-box">
            <div class="subjects-wraper">
                <div class="row">
                    <div class="col-3 col-md-2 d-flex d-md-block justify-content-center">
                        <img class="logo" src='<?php echo $category['crb_cat_photo']; ?>'>
                    </div>
                    <div class="col-9 col-md-10">
                        <h3><?php echo $category['title']; ?></h3>
                          <?php foreach ($category["sub_crb_cat"] as $scid => $subcat) {  ?>
                        <ul>
                            <li>
                                
                              <a href="<?php echo get_permalink($pageID); ?>/?cid=<?php echo $cid ?>&scid=<?php echo $scid ?>&data=<?php echo $subcat['api_title'] ?>&parent=<?php echo $category['title'] ?>&son=<?php echo $subcat['title'] ?>&list"><?php echo $subcat['title'] ?></a>
                            </li>
                        </ul>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>
    
  <?php }
  }?>
