<ul class="tabnav el">
    <?php
    $class = '';
    if ($_SERVER['SCRIPT_NAME']=='/shop/admin/categories/manage.categories.php'
        || ($_SERVER['SCRIPT_NAME']=='/shop/admin/categories/edit.category.php' && !empty($_REQUEST['id']))
    ) {
        $class = 'selected';
    }
    $manage_url = !empty($_REQUEST['id']) ?
        '/shop/admin/categories/edit.category.php?id=' . $_REQUEST['id'] :
        '/shop/admin/categories/manage.categories.php';
    ?>
    <li class="<?= $class ?>">
        <a href="<?=$manage_url; ?>">
            Manage
        </a>
    </li>
    <?php
    $class = '';
    if ($_SERVER['SCRIPT_NAME']=='/shop/admin/categories/edit.category.php' && empty($_REQUEST['id'])) {
        $class = 'selected';
    }
    $sub_id_param = !empty($_REQUEST['sub_id']) ? 'sub_id=' . $_REQUEST['sub_id'] : '';
    ?>
    <li class="<?= $class ?>">
        <a href="/shop/admin/categories/edit.category.php?<?= $sub_id_param ?>">
            Add
        </a>
    </li>
    <?php
    if (!empty($_REQUEST['id'])) {
        $class = $_SERVER['SCRIPT_NAME'] === '/plugins/ItemFAQ/admin/index.php' ? 'selected' : '';
        ?>
        <li class="<?= $class ?>">
            <a href="/plugins/ItemFAQ/admin/index.php?id=<?= $_REQUEST['id']; ?>&type=category">
                Category FAQ
            </a>
        </li>
        <?php
    }
    ?>
</ul>
