<?php
if ($categories) {
  $cnt = 0;
  $thumbsize = explode('x', CARD_THUMB);
  foreach ($categories as $cat) {
    $cnt++;
    if ($cat['thumb']) {
      $thumb = APP_URL . '/upload_file/folderthumb/' . CARD_THUMB . '/' . $cat['thumb'];
    } else {
      $thumb = APP_URL . '/assets/images/folder.png';
    }
    if ($cat['is_cat'] == 1) {
      $list_href = 'categorie';
      $catYear = '';
    } else {
      $list_href = 'album';
      $catYear = ($cat['release_year'])?' ('.$cat['release_year'].')':'';
    }
    $catName = ($catYear)?$cat['name'].' <span>(' . $cat['release_year'].')</span>':$cat['name'];
  echo '<li class="list-group-item">
    <a href="' . APP_URL . '/' . $list_href . '/' . $cat['slug'] . $endRoute . '" class="d-flex list-m">
<img style="width:50px;height:50px;" src="' . APP_URL . '/assets/images/folder.svg" data-src="' . $thumb . '" class="lazy float-start rounded" alt="' . $cat['name'] . '">
        <div class="ms-2 text-truncate align-self-center w-100">
            <h4>' . $catName . '</h4>
            <p>Total Ringtones: ' . $cat['totalitem'] . '</p>
        </div>
    </a>
</li>';
    if ($cnt % ADVT_EACH == 0) {
      echo getAds($AdsPath . '/between_catlist');
    }
  }
  unset($categories);
  unset($thumbsize);
}