<th>Name</th> <th>Sub Categories</th> <th>Action</th> </tr> <?php $parentList = $parentController->getAll(); if ($parentList) { foreach ($parentList as $parent) { ?> <tr> <td><?php echo $parent->getCategory(); ?> </td> <td><?php if ($cc = $categoryController->getByParent($parent->getId())) { echo count($cc); } else { echo "0"; } ?> </td> <td> <div class="action-icon"> <span><a href="<?php echo Route::getAdminDirectory(); ?> categories/edit.php?type=p&post=<?php echo $parent->getId(); ?> "><i class="fa fa-eye" title="View"></i></a></span>